Skip to content

avohq/java-avo-inspector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Avo Inspector SDK for Java

Avo documentation

This is a quick start guide. For more information about the Inspector project please read Avo documentation.

Installation

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.

Initialization

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);

Enabling logs

Logs are enabled by default in the dev mode and disabled in prod mode based on the init flag.

AvoInspector.enableLogging(true);

Sending event schemas

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

1.

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.

Override Avo source

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"));

2.

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());
        }});

Extracting event schema manually

Map<String, AvoEventSchemaType> schema = avoInspector.extractSchema(new HashMap<String, Object>() {{
            put("String Prop", "Prop Value");
            put("Float Name", 1.0);
            put("Bool Name", true);
        }});

Author

Avo (https://www.avo.app), [email protected]

License

AvoInspector is available under the MIT license.