Avo Inspector Node.js SDK
Quick Start Guide
Find the Quick Start Guide in our GitHub repo.
Installation
The library is distributed with NPM, install with npm:
npm i node-avo-inspector
Import
import * as Inspector from "node-avo-inspector";
Initialization
Obtain the API key in Inspector tab in your Avo.app workspace.
You will need to create an instance of AvoInspector with the constructor:
constructor(options: {
apiKey: string;
env: AvoInspectorEnv;
version: string;
appName?: string;
});
All the following methods are available in the AvoInspector class.
Parameters:
apiKey
- the API key you get in your Avo accountenv
- current environment:"dev"
,"staging"
or"prod"
appVersion
- your application version. A lot of Inspector features rely on versioning and you need to provide a comparable string here to get value from them. We recommend using semantic versioning or integers that are incremented in every release.appName
- your application name. Optional; Provide it to make it easier to distinguish between data from different apps.
Sending event schemas to Avo Inspector
This is the core of the Avo Inspector SDK.
trackSchemaFromEvent(eventName: string, eventProperties: {
[propName: string]: any;
}): void;
Parameters:
eventName
- string event name, also known as event type.eventProperties
- The actual event properties, which will be converted to an event schema on the device and the event schema sent to Avo. The resulting keys will be object field names and the values will be object field value types converted to schema types.Example format:
var eventProperties = { userId: 1337, emailAddress: 'jane.doe@avo.app', key: 'value', };
Configuring Logs
enableLogging
controls printing of tracked event schemas and other helpful information to logcat. Enabled by default in development environments.
enableLogging(enable: boolean): void;
Parameters:
enable
- boolean flag that sets whether Avo Inspector SDK will print logs .