AppSamurai Attribution SDK

alt text

Getting Started

The AppSamurai Attribution SDK is available via:

JCenter AAR Download The AppSamurai Attribution SDK is available as an AAR via JCenter; to use it, add the following to your build.gradle.

repositories {
    jcenter() // includes the AppSamurai Attribution SDK
}

dependencies {
    // Be sure that you are using latest version
    implementation 'com.ppsmr.attribution.attributionsdk:attribution:<latest-version>'
}

Supported SDK Versions

Minimum supported SDK version is 14. Be sure that minSdkVersion in your gradle file isn't lower than 14.

Usage

You can check sample applications in the repository to see the examples of how to integrate and use the SDK.

SDK Import

Kotlin Users

import com.ppsmr.attribution.attributionsdk.AttributionSDK

Java Users

import com.ppsmr.attribution.attributionsdk.AttributionSDK;

SDK Initialization

AppSamurai Attribution SDK is required for tracking. Application cannot track any information before SDK initialization is complete. In application’s onCreate method of the initial activity, call AttributionSDK.initialize function with applicationId parameter. This parameter should be your application id from AppSamurai User Dashboard, you can use your application id for integration purposes. Be sure to call this initialization in each onCreate method of your initial activities. Check the following codes for sample:

Kotlin Users

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    AttributionSDK.initialize("your-user-id")
}

Java Users

@Override
protected void onCreate (Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    AttributionSDK.Instance.initialize("your-user-id");
}

Custom Event Tracking

Using AppSamurai Attribution SDK, you are able to track the frequency of custom events by placing the following code piece into your own application code. You can also attach data to your events. Only JSONObject is accepted as data. If you are planning to put an object as a value in JSONObject, make sure the object is JSON serializable.

Kotlin Users

AttributionSDK.track(eventName: String)
AttributionSDK.track(eventName: String, data: JSONObject)

Java Users

AttributionSDK.Instance.track(String eventName);
AttributionSDK.Instance.track(String eventName, JSONObject data);

Log Level

AppSamurai Attribution SDK logging level can be changed with setLogLevel after AttributionSDK.initialize call. Default is <ASLog.Level.DEBUG>.

Kotlin Users

AttributionSDK.setLogLevel(<ASLog.Level>)

Java Users

AttributionSDK.Instance.setLogLevel(<ASLog.Level>);

Sample Usages

Sample usages can be found in the repository for both Kotlin and Java.

Author

App Samurai Mobile Team, mobile@appsamurai.com

License

Copyright 2018 App Samurai Inc. alt text