Step 1. Add the JitPack repository to your build file
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
implementation 'com.github.EulerianTechnologies:eanalytics-android:1.9.0'
}
Step 3. In your AndroidManifest.xml, add the following permissions :
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
Before using the SDK make sure to initialize it, in your Application onCreate() for instance.
<!-- in your AndroidManifest.xml-->
<application
android:name=".DemoApp">
public class DemoApp extends Application {
@Override
public void onCreate() {
super.onCreate();
EAnalytics.init(this, "example.demo.com", false);
}
}
Now you can track any properties you want. The generic properties is EAProperties, and the SDK provides convenience classes for the most common usage (ie. EACart, EAEstimate, EAProducts, etc...)
EASearch search = new EASearch.Builder("/path-example", "banana")
.setParams(new Params.Builder()
.addParam("provenance", "martinique")
.addParam("couleur", "jaune")
.build())
.setResults(42)
.build();
EAnalytics.getInstance().track(search)
Please note that Eulerian Analytics SDK includes the following dependencies :
- com.google.android.gms:play-services-base:9.2.0
Step 1 to 3 has been reduced in simply grabbing Eulerian Analytics sdk via Gradle.
Link to Android tagging plan