Package Exports
- avo-inspector
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (avo-inspector) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Avo Inspector
Avo documentation
This is a quick start guide. For more information about the Inspector project please read Avo documentation.
Installation
The library is distributed with npm
npm i avo-inspector
or
yarn add avo-inspector
Initialization
Obtain the API key at Avo.app
import * as Inspector from "avo-inspector";
let inspector = new Inspector.AvoInspector({
apiKey: "your api key",
env: Inspector.AvoInspectorEnv.Dev,
version: "1.0.0",
appName: "My app"
});
Enabling logs
Logs are enabled by default in the dev mode and disabled in prod mode.
Java
inspector.enableLogging(true);
Sending event schemas
Whenever you send tracking event call one of the following methods: Read more in the Avo documentation
1.
This method gets actual tracking event parameters, extracts schema automatically and sends 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.
inspector.trackSchemaFromEvent("Event name", {
"String Prop": "Prop Value",
"Float Prop": 1.0,
"Boolean Prop": true
});
2.
If you prefer to extract data schema manually you would use this method.
inspector.trackSchema("Event name", [
{ propertyName: "String prop", propertyType: "string" },
{ propertyName: "Float prop", propertyType: "float" },
{ propertyName: "Boolean prop", propertyType: "boolean" },
]);
Extracting event schema manually
let schema = inspector.extractSchema({
"String Prop": "Prop Value",
"Float Prop": 1.0,
"Boolean Prop": true
});
You can experiment with this method to see how more complex schemas look, for example with nested lists and objects.
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 development mode default batch flush timeout is 1 second, i.e. the SDK batches schemas of events sent withing one second.
inspector.setBatchSize(15);
inspector.setBatchFlushSeconds(10);
Author
Avo (https://www.avo.app), friends@avo.app
License
AvoInspector is available under the MIT license.