AvoInspector 2.0.1

AvoInspector 2.0.1

Maintained by Alex Verein.



  • By
  • Avo (https://www.avo.app)

AvoInspector

Version License Platform

Avo documentation

This is a quick start guide. For more information about the Inspector project please read Avo documentation.

Installation

AvoInspector is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'AvoInspector'

The latest version can be found in GitHub releases tab.

Import

Obj-C

#import <AvoInspector/AvoInspector.h>

Swift

import AvoInspector

Initialization

Obtain the API key at Avo.app

Obj-C

AvoInspector *avoInspector = [[AvoInspector alloc] initWithApiKey:@"apiKey" env: AvoInspectorEnvDev];

Swift

let avoInspector = AvoInspector(apiKey: "apiKey", env: AvoInspectorEnv.dev)

Enabling logs

Logs are enabled by default in the dev mode and disabled in prod mode based on the init flag.

Obj-C

[AvoInspector setLogging:YES];

Swift

AvoInspector.setLogging(true)

Integrating with Avo Functions (Avo generated code)

The setup is lightweight and is covered in this guide.

Every event sent with Avo Function after this integration will automatically be sent to the Avo Inspector.

Sending event schemas for events reported outside of Avo Functions

Whenever you send tracking event call one of the following methods:

Read more in the Avo documentation

1.

This methods get actual tracking event parameters, extract schema automatically and send it to the Avo Inspector backend. It is the easiest way to use the library, just call this method at the same place you call your analytics tools' track methods with the same parameters.

Obj-C

[avoInspector trackSchemaFromEvent:@"Event Name" eventParams:@{@"id": @"sdf-334fsg-334f", @"number": @41}];

Swift

avoInspector.trackSchema(fromEvent: "Event Name", eventParams: ["id": "sdf-334fsg-334f", "number": 41])

2.

If you prefer to extract data schema manually you would use this method.

Obj-C

[avoInspector trackSchema:@"Event Name" eventSchema:@{@"id": [[AvoString alloc] init], @"number": [[AvoInt alloc] init]}];

Swift

avoInspector.trackSchema("Event Name", eventSchema: ["id": AvoString(), "number": AvoInt()])

Extracting event schema manually

Obj-C

NSDictionary * schema = [avoInspector extractSchema:@{@"id": @"sdf-334fsg-334f", @"number": @41}];

Swift

let schema = avoInspector.extractSchema(["id": "sdf-334fsg-334f", "number": 41])

Using the Visual Inspector

Visual Inspector is enabled in development and staging environments by default.

Show

Obj-C

[avoInspector showVisualInspector:Bar]; // or Bubble

Swift

avoInspector.show(AvoVisualInspectorType.Bar) // or AvoVisualInspectorType.Bubble

Hide

Obj-C

[avoInspector hideVisualInspector];

Swift

avoInspector.hideVisualInspector()

Advanced usage

You can get an instance of AnalyticsDebugger with the following method.

Obj-C

[avoInspector getVisualInspector];

Swift

avoInspector.getVisualInspector()

See more about AnalyticsDebugger in GitHub repo

Batching control

In order to ensure our SDK doesn't have a large impact on performance or battery life it supports event schemas batching.

Default batch size is 30 and default batch flush timeout is 30 seconds. In debug mode default batch flush timeout is 1 second, i.e. the SDK batches schemas of events sent withing one second.

Obj-C

[AvoInspector setBatchSize:15];
[AvoInspector setBatchFlushSeconds:10];

Swift

AvoInspector.setBatchSize(15)
AvoInspector.setBatchFlushSeconds(10)

Example App

To run the example project, clone the repo, and run pod install from the Example directory first.

Author

Avo (https://www.avo.app), [email protected]

License

AvoInspector is available under the MIT license. See the LICENSE file for more info.