Adjust is a platform for tracking attribution for advertising 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.
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).
install
, sale
, and session
.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.
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.
Install_Referrer intent is no longer supported by Google Play. Feel free to remove the following from your AndroidManifest.xml
and be sure to implement the Google Play Referrer API for Adjust instead.
<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>
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.
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.
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.
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.
Adjust has support for Tracking Uninstalls and Reinstalls. Uninstall and Reinstall tracking rely’s on passing the Firebase Push Token for Android or Device Token for iOS to the Adjust API. This may be done using the Analytics.setPushToken()
method. NOTE: setPushToken() must be invoked after initialize is invoked or analytics.start() if using deferred analytics. You will likely need to modify the examples below to store the device/push token until the SDK is initialized
// task is Task<InstanceIdResult> task returned from Firebase
String token = task.getResult().getToken();
kongregateAPI.analytics().setPushToken(token);
(void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
[[[KongregateAPI instance] analytics] setPushToken:deviceToken];
}
#ifdef UNITY_IPHONE
byte[] token = UnityEngine.iOS.NotificationServices.deviceToken;
if (token != null) {
String encodedToken = Convert.ToBase64String(token);
Kongregate.GetAPI().Analytics.SetPushToken(mEncodedPushToken);
}
#end
#ifdef UNITY_ANDROID
public void OnTokenReceived(object sender, Firebase.Messaging.TokenReceivedEventArgs token) {
Kongregate.GetAPI().Analytics.SetPushToken(token.Token);
}
#end
// token is the Firebase Push Token or Base64 encoded iOS Device Token
Kongregate.analytics.setPushToken(token)
Please see the Adjust documentation for Adding FCM Key to the Adust Dashboard and/or Uploading the Push Certificate to Adjust.
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.
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.