Android SDK

Get started

To start tracking using Offer18's Android SDK, you'll need to integrate the SDK into your application as a dependency.

For Gradle in Kotlin, Add dependencies in the build.gradle.kts file

implementation("com.offer18:android-sdk:{VERSION}")

For Gradle in Groovy, Add dependencies in the build.gradle file

implementation 'com.offer18:android-sdk:{VERSION}'

You must replace {VERSION} with latest stable version of Offer18's Android SDK

Find out latest stable version of Android SDK


Permissions

Make sure your app has permissions given below

<uses-permission android:name="android.permission.INTERNET"/>


SDK Initialization

Import Offer18 Class from com.offer18.sdk package

import com.offer18.sdk.Offer18;

To initialize the Software Development Kit (SDK) insert the provided code snippet in your application code.

Offer18.init(getApplicationBaseContext(), "{DOMAIN}", "{ACCOUNT_ID}","tid_key_in_referrer_url");
  • Replace {DOMAIN} with your tracking domain.

  • Replace {ACCOUNT_ID} with your Account ID.

  • Replace tid_key_in_referrer_url With your own parameter key for tid


Track Conversions

Import Offer18 Class from com.offer18.sdk package

import com.offer18.sdk.Offer18;

To activate conversion tracking with Offer18's Android SDK, you'll need to insert a specific code snippet onto the order success page (Thank You Page) of your app.

Map<String, String> args = new HashMap<>();  
args.put("o", ""); // 0000000 (Offer ID)
args.put("tid", "");  // x-xxxx-xxxxxx-xxxxxx (Click ID)
args.put("event", ""); // install
args.put("adv_sub1", ""); 
args.put("adv_sub2", "");
args.put("adv_sub3", "");
args.put("adv_sub4", "");
args.put("adv_sub5", "");
args.put("coupon", "");
args.put("sale", "");
args.put("payout", "");
Offer18.trackConversion(args);


Track Conversion (Automatic)

Import Offer18 Class from com.offer18.sdk package

import com.offer18.sdk.Offer18;

If you prefer not to fetch Referrer details to obtain the click ID, you can utilize Offer18's Click ID key in the configuration.

Initialize SDK

To initialize the Software Development Kit (SDK) insert the provided code snippet in your application code.

Offer18.init(getApplicationBaseContext(), "{DOMAIN}", "{ACCOUNT_ID}","tid_key_in_referrer_url");

Complete Conversion

Map<String, String> args = new HashMap<>();  
args.put("o", ""); // Offer ID  
args.put("tid", "{REFERRER_TID}"); // Auto fill TID
args.put("event", ""); // install
args.put("adv_sub1", "");
args.put("adv_sub2", "");
args.put("adv_sub3", "");
args.put("adv_sub4", "");
args.put("adv_sub5", "");
args.put("coupon", "");
args.put("sale", "");
args.put("payout", "");
Offer18.trackConversion(args);

The "{REFERRER_TID}" will automatically retrieve the click ID from the Referrer URL and include it in the trackConversion.

  • TID will be detected automatically based on key value provided during SDK initialization

  • Replacement will occur when micro {REFERRER_TID} is detected

  • trackConversion will be fail if

    • No manual tid provided,

    • No tid detected using referral url

    • tid detected but no macro provided

    • Macro provided but no tid or empty tid detected from referrer url

Last updated