Trackingplan for Android SDK

Trackingplan

With Trackingplan for Android you can make sure that your tracking is going as you planned without changing your current analytics stack or code.

Trackingplan will monitor traffic between your app and data destinations and automatically detect any changes in your analytics implementation and warn you about inconsistencies like hit drops, missing properties, rogue events, and more.

Trackingplan is currently available for Web, iOS and Android. More clients will come soon.

Please request your TrackingplanId at trackingplan.com or write us to [email protected].

Add Trackingplan to your Android app

The recommended way to install Trackingplan for Android is by using Android Studio. Please, make sure your project targets API level 21 (Lollipop) or later.

First, add the Trackingplan dependency using Android Studio, like so:

In Android Studio, expand the Gradle Scripts section

image

Select the project-level build.gradle file and add com.trackingplan.client:adapter:1.1.2 as a classpath dependency to the dependencies section:

dependencies {   
    // ...
    classpath "com.trackingplan.client:adapter:1.1.2"
    // ...
}

After that, select the module-level build.gradle file and modify it as indicated below:

  • Add id 'com.trackingplan.client' to the plugins section.
plugins {
    // ...
    id 'com.trackingplan.client'
    // ...
}
  • Add implementation 'com.trackingplan.client:sdk:1.1.2' to the dependencies section.
dependencies {
    // ...
    implementation 'com.trackingplan.client:sdk:1.1.2'
    // ...
}

Then in the onCreate method of your Application's Main Activity, set up the SDK like so:

Trackingplan.init("YOUR TRACKINGPLAN ID GOES HERE").start(this)

And of course, import the SDK:

import com.trackingplan.client.sdk.Trackingplan;

All set!

Advanced options

Trackingplan for Android supports the same Advanced Options as Trackingplan for Web.
For instance, to set a source alias and turn on debug mode use the following:

Trackingplan.init("YOUR TRACKINGPLAN ID GOES HERE")
    .sourceAlias("Android app")
    .enableDebug()
    .start(this)

Check the JS SDK's Advanced Options section for more details.

Additionaly, there is a dryRun option available to let you test Trackingplan for Android without actually sending any data to Trackingplan.

Building from source code

First of all, clone this repository to a local directory in your machine. After that, open a terminal in that directory and run:

$ ./gradlew cleanBuildLocalPublish

In order to use this custom built, modify your project-level build.gradle file as indicated below:

buildscript {
    repositories {
        // ...
        mavenLocal() // <-- Add maven local
    }

}

allprojects {
    repositories {
        // ...
        mavenLocal() // <-- Add maven local
    }
}    

Remember to change the version of Trackingplan in your dependencies to 1.0.0-SNAPSHOT.

Need help?

Questions? Problems? Need more info? We can help! Contact us here.

License

Copyright © 2021 Trackingplan Inc. All Rights Reserved.

GitHub

https://github.com/trackingplan/trackingplan-android