Reference
Avo Inspector SDKs
Overview

Avo Inspector SDK overview

Avo Inspector analyzes the analytics events sent from your app, without collecting the actual data (not yet another tool to add to your privacy policy). Based on that analysis Avo automatically builds a single source of truth tracking plan, covering all your products and platforms, giving you a complete overview of which is tracking what, and which is not.

Avo Inspector SDK is designed to be small and easy to include in any project.

Avo Inspector SDK extracts tracking plan information from your existing tracking calls. It provides methods to get the shape of an event you are going to send to the analytics platform and then to send that shape alongside the event name for analysis. The SDKs are distributed with the standard mechanism of the platform, like npm package, gradle dependency or cocoapods.

Platform documentation

Avo Inspector initialization

Before using Avo Inspector SDK you need to obtain an API key from Inspector Setup in the source details of your source and provide it to the initialization method.

Inspector Setup

Then you provide the API key when defining Inspector in your code.

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

Inspecting events

Whenever an event is tracked, you need to call either trackSchemaFromEvent(eventName: String, eventParams: Map) or trackSchema(eventName: String, eventSchema: Map)

The difference is that in the first method the event object is transformed into an event schema under the hood and in the second method you provide the event schema. Eventually in both methods the event schema is sent to Avo servers for analysis.

The event schema format is a map, similar to the format most events use, but with type names instead of actual values. For example if you track CheckoutCompleted event

{
  "userId": 1337,
  "emailAddress": "jane.doe@avo.app",
  "productId": 45,
  "revenue": 15.99,
  "timestamp": 1579263014,
  "deviceId": "sdf-23-trr-456-0000"
}

The following event schema would be sent to Avo:

{
  "userId": "int",
  "emailAddress": "string",
  "productId": "int",
  "revenue": "float",
  "timestamp": "int",
  "deviceId": "string"
}

Note: You can extract the schema separately with extractSchema(eventParams: Map), the same method that's used by trackSchemaFromEvent(eventName: String, eventParams: Map)

Example

func trackAppOpened(appOpenedEvent: Dictionary<String, Any>) {
    tracker.track(eventName: "App Opened", eventParams: appOpenedEvent);
    SceneDelegate.avoInspector?.trackSchema(fromEvent: "App Opened", eventParams: appOpenedEvent)
}

Supported event schema types in Avo Inspector

null, int, float, boolean, string, combination of types, e.g. an optional integer would look like integer | null. If we've seen a mix of integers, strings and nulls it will be integer | string | null. List can be a part of combination. parametrized list, i. e. list<integer | null> nested objects

Bonus: this docs you are reading are open sourced (opens in a new tab), if you find anything wrong or missing, please open a pull request or an issue!

Logs

You can enable or disable logs with a method on the AvoInspector class (the interface may vary depending on platform, see platform specific documentation above)

AvoInspector.enableLogging(isEnabled)

The printed logs are the following, in the chronological order:

  • Avo Inspector: supplied event ...: when an event is provided to Avo Inspector
  • Avo Inspector: extracting schema from ...: right before extraction of the schema from a supplied event
  • Avo Inspector: saved event ...: when the event schema is saved locally to send it to Avo servers later, due to batching
  • Avo Inspector: events ...: before sending the data it prints the list of event schemas that are going to be sent
  • Avo Inspector: batch sent successfully.: when the event schemas are successfully sent
When setting up Inspector make sure that you see the Avo Inspector: batch sent successfully log. That means that your setup is most likely correct.

Batching

In order to ensure our SDK doesn't have a large impact on performance or battery life it supports event schemas batching. In production, default values are 30 schemas per batch and smaller batches are sent if more than 30 seconds pass between uploads. In development batching is disabled by default. You can change the values using AvoInspector.setBatchSize(newBatchSize: Int) and AvoInspector.setBatchFlushSeconds(newBatchFlushSeconds: Int) class methods to fine tune the library performance.

App versions

When initializing Inspector SDK you'll be prompted to provide the current app version. Providing correct app version is not required, but doing so significantly improves Inspector issue reporting. By providing app version Inspector is able to tell in what version an issue was first seen, and in what version the issue was fixed. Versions also allow Inspector to report more accurately on the implementation status of your events, by focusing on the implementation status in your latest app version for every source.

We recommend using semantic versioning (e.g. "1.0.0") or other types of numeric versioning (e.g. build number) which get incremented on every release.

Examples of great app versions, incremented with every feature release:

  • 4.11.2
  • 1.110.0
  • 1452
  • 42

Examples of bad app versions:

  • 0f5d04ddbb401971b2f9c7f6186f58161692c3d8
  • prod.commit.b401971

Don't have versioning for your app in place? Reach out to us and we'll help you set up versioning in your app.

What's next?

Once you have successfully installed Inspector, you can start seeing your events appear in the Inspector events view and your issues in the Inspector Issues view.