Application Analytics for Conviva Android Sensor

Use Application Analytics to autocollect events and track application specific events and state changes.

Updated 2026-05-29 android, application, analytics, sensor developer center, sensor integration, application analytics

Use Application Analytics to autocollect events and track application specific events and state changes.

Download

Description Version File Updated
conviva-android-tracker.zip v0.2.2 Download conviva-android-tracker-0.2.2.zip 12/MAY/2022

Supported System Version:

  • Target sdk version : Android 12L (API level 32)

  • Minimum sdk version : Android 4.0.4 (API level 15)

Initialization

Install the Conviva Android application sensor SDK using Gradle

implementation 'com.conviva.sdk:conviva-android-tracker:<version>'

Or download and add the library explicitly from Conviva GitHub: https://github.com/Conviva/conviva-android-appanalytics

Add Dependencies
// Conviva video sensor dependency(supported 4.0.19 onwards) 
implementation 'com.conviva.sdk:conviva-core-sdk:<version>'

// If 'lifecycleAutotracking' is enabled
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'

// If 'installAutotracking' is enabled 
implementation 'com.android.installreferrer:installreferrer:2.2'

 // Dependency package required for Conviva Android tracker
 implementation 'com.squareup.okhttp3:okhttp:4.9.1'

Initialize the tracker by enabling autocollection

TrackerController tracker = ConvivaAppAnalytics.createTracker(context,
    <YOUR_CUSTOMER_KEY_ADVISED_BY_Conviva>,
    <YOUR_APP_NAME_ADVISED_BY_Conviva>
);

Set the user id (viewer id)

tracker.getSubject().setUserId(userId);

Extend tracking to track your application specific events and state changes

Use trackCustomEvent() API to track all kinds of events. This API provides 2 fields to describe the tracked events.

  • eventName - Name of the custom event.

  • eventData - Any type of data in string format.

The following example shows the implementation of the 'onClick' event listener to any element.

// … send 'structured' events 'onClick' of button
tracker.track(new Structured("your-event-category", "your-event-action")
    .label("label")
    .property("property")
    .value(0.00));
// … send events 'onClick' of button
HashMap<String, Object> eventData = new HashMap<>(); 
eventData.put("identifier1", intValue); 
eventData.put("identifier2", boolValue); 
eventData.put("identifier3", "stringValue");
tracker.trackCustomEvent("your-event-name", JSONValue.toJSONString(eventData));