This is a quick start guide. For more information about the Inspector project please read Avo documentation.
We host the library on JitPack.io, so
add the following to the build.gradle file:
repositories {
mavenCentral()
...
maven { url 'https://jitpack.io' }
}
and:
dependencies {
implementation 'com.github.avohq.java-avo-inspector:TAG'
}
Use the latest GitHub release tag to get the latest version of the library.
Obtain the API key at Avo.app
import is.avo.inspector.AvoInspector;
import is.avo.inspector.AvoInspectorEnv;
AvoInspector avoInspector = new AvoInspector("MY_API_KEY", "1.0.0", "My App Name", AvoInspectorEnv.Dev);
Logs are enabled by default in the dev mode and disabled in prod mode based on the init flag.
AvoInspector.enableLogging(true);
Whenever you send tracking event call one of the following methods.
Example usage:
void trackAppOpened(Map<String, ?> appOpenedEventParams) {
tracker.track("App Opened", appOpenedEventParams);
this.avoInspector.trackSchemaFromEvent("App Opened", appOpenedEventParams);
}
Read more in the Avo documentation
These 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.
avoInspector.trackSchemaFromEvent("Event name", new HashMap<String, Object>() {{
put("String Prop", "Prop Value");
put("Float Name", 1.0);
put("Bool Name", true);
}});
Second parameter can also be a JSONObject
.
You can track a schema for an Avo source different from the one you've initialised Avo Inspector instance with by providing an additional AvoInspectorTarget
parameter to the trackSchemaFromEvent
call.
avoInspector.trackSchemaFromEvent("Event name", new HashMap<String, Object>() {{
put("String Prop", "Prop Value");
put("Float Name", 1.0);
put("Bool Name", true);
}}, new AvoInspectorTarget("Another-Api-Key", "Another-App-Name", "Another-App-Version"));
If you prefer to extract data schema manually you would use this method to send the extracted event schema.
avoInspector.trackSchema("Event name", new HashMap<String, AvoEventSchemaType>() {{
put("String Prop", new AvoEventSchemaType.AvoString());
put("Float Name", new AvoEventSchemaType.AvoFloat());
put("Bool Name", new AvoEventSchemaType.AvoBoolean());
}});
Map<String, AvoEventSchemaType> schema = avoInspector.extractSchema(new HashMap<String, Object>() {{
put("String Prop", "Prop Value");
put("Float Name", 1.0);
put("Bool Name", true);
}});
Avo (https://www.avo.app), [email protected]
AvoInspector is available under the MIT license.