Skip to content

Integration

Abhishek Nandi edited this page Nov 9, 2016 · 1 revision

PureMetrics Android SDK Integration Guide

Follow the steps below to integrate the SDK ##Integration Add the following in the build.gradle of your app module

compile 'io.puremetrics:core:1.2.1+'

Add the following line in your Application class

PureMetrics.withBuilder()
    .setAppConfiguration(APP_ID, APP_SECRET)
    .init(getApplicationContext());

Optional Configurations

In case you want to configure the session duration (Default session duration is 30mins)

PureMetrics.withBuilder()
    .setSessionDuration(1200000L)//20mins session duration in milliseconds
    ...
    .init(getApplicationContext());

In case you want to disable auto tracking

PureMetrics.withBuilder()
    .disableAutoTracking(true)
    ...
    .init(getApplicationContext());

In case you have disabled auto tracking, you have to explicitly call session start. Additionally you can also pass some extra in the argument in the form of a HashMap.

PureMetrics.trackSessionStart(null, null);

In case you want to enable debug logs

PureMetrics.withBuilder()
    .setLoggingLevel(PureMetrics.LOG_LEVEL.DEBUG)
    ...
    .init(getApplicationContext());

Go through the navigation bar on the right to track revenue, onboarding, referral, custom events etc.

Clone this wiki locally