Adjust Overview

Adjust is a platform for tracking attribution for avertising sources and analytics. The Adjust SDK is wrapped by the Kongregate SDK. If initialized with Adjust keys, the Kongregate SDK will fire basic events to Adjust.

This guide describes how to initialize the Kongregate SDK to use Adjust.

Before You Start

You will need to collect the following information from your Kongregate producer For Each Platform (iOS, Android, Amazon, will each have their own Adjust tokens).

Sandbox and Production Environments

In each configuration below, you must specify whether the build should use the Adjust production or sandbox environment. For best results, leave this set to sandbox for all but Release Candidate builds. This is to minimize the effect of test builds on production analytics.

Android

For Android, you will need to initialize the Kongregate SDK with the following new options, which tells our SDK which tokens to use for your projectand each event.

Map<String,Object> apiOptions = new HashMap<String,Object>();
apiOptions.put(KongregateAPI.KONGREGATE_OPTION_ADJUST_APP_TOKEN, "abcdef123456");
apiOptions.put(KongregateAPI.KONGREGATE_OPTION_ADJUST_ENVIRONMENT, "sandbox");
apiOptions.put(KongregateAPI.KONGREGATE_ADJUST_SALE_EVENT_TOKEN, "abc123");
apiOptions.put(KongregateAPI.KONGREGATE_ADJUST_INSTALL_EVENT_TOKEN, "def123");
apiOptions.put(KongregateAPI.KONGREGATE_ADJUST_SESSION_EVENT_TOKEN, "ghi123");
// add other options

APIBootstrap.initializeNativeAPI(activity, gameId, apiKey, apiOptions);

IMPORTANT: prior to delivering builds that will be submitted for release to the app store, you must change KONGREGATE_OPTION_ADJUST_ENVIRONMENT to production. A toast message is displayed while in sandbox mode to help remind you.

Add the Adjust ReferrerReceiver to the Kongregate InstallReceiver foreward list. The example below forewards to both AdX and Adjust.

<receiver android:name="com.kongregate.android.api.receivers.InstallReceiver" android:exported="true">
    <intent-filter>
        <action android:name="com.android.vending.INSTALL_REFERRER" />
    </intent-filter>
	<meta-data android:name="foreward.AdXAppTracker"
               android:value="com.AdX.tag.AdXAppTracker"/>
    <meta-data android:name="foreward.adjust"
               android:value="com.adjust.sdk.AdjustReferrerReceiver"/>
 </receiver>

Google Play Referrer API

To enable the new Google Play Referrer API you must add the required library to your project. For Gradle based builds follow Adjust’s Gradle Instructions to add the dependency. For non-Gradle builds follow Adjust Unity Instructions to add the dependency. Note: you will need to manually add the BIND_GET_INSTALL_REFERRER_SERVICE permission as described here.

iOS

For iOS integration, simply pass the Adjust App Token and 3 Event Tokens with the initialization map.

NSDictionary* apiSettings = @{
    KONGREGATE_OPTION_ADJUST_APP_TOKEN: @"abcdef123456",
    KONGREGATE_OPTION_ADJUST_ENVIRONMENT: @"sandbox",
    KONGREGATE_ADJUST_INSTALL_EVENT_TOKEN: @"abc123",
    KONGREGATE_ADJUST_SESSION_EVENT_TOKEN: @"def123",
    KONGREGATE_ADJUST_SALE_EVENT_TOKEN: @"hij123"
};

IMPORTANT: Be sure set the KONGREGATE_OPTION_ADJUST_ENVIRONMENT to production for builds that will be submitted to the App Store.

Set -ObjC linker flag:

Adjust requires the -ObjC linker flag to be included. In X-Code add this flag to Build Settings -> Other Linker Flags, if it is not already set.

Unity

For Unity integration on Android you must make the above modifications to your Assets/Plugins/Android/AndroidManifest.xml file, and pass along the Adjust initialization options like so:

KongregateAPI.Settings.AdjustAppToken = "abcdef123456";
KongregateAPI.Settings.AdjustEnvironment = "sandbox"; // be sure to set to "production" for release builds
KongregateAPI.Settings.AdjustEventTokenMap = new Dictionary<string,object> {
	{ KongregateAPI.ADJUST_INSTALL, "abc123" },
    { KongregateAPI.ADJUST_SALE, "def123" },
    { KongregateAPI.ADJUST_SESSION, "ghi123" }
};
// setup other settings
KongregateAPI.Initialize(gameId, apiKey);
}

IMPORTANT: Be sure set the AdjustEnvironment to production for builds that will be submitted to the App Store.

Testing

There are several ways to test that the integration is complete. The simplest is to view the console or logcat and search for Adjust. You should see logging for registering sessions and if you make a test purchase, the sale event. Keep an eye out for any Kongregate Warning or Error messages.

About a half-hour to an hour after events are fired, they should appear on the Adjust Dashboard.

To go deeper, setup a proxy such as Charles and you should be able to see the successful request and responses to/from the Adjust servers.

You may follow these links from a device to have Adjust clear it’s entry and treat the next install as fresh.

More Information

The Adjust Docs Site has a lot more detail on setup and testing. If you are using iOS or Android, you may access the Adjust singletons directly.