Tracking Observability
Inspector SDKs

Avo Inspector overview

Avo Inspector SDK

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.

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!

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.

Implement Inspector SDK

Now when you know how Inspector SDK works it's good time to implement it in your application. Here is the documentation.