This Guide details how to integrate Kongregate and Adjust Analytics into your Unity Game.
A Unity Plugin is included with the Kongregate SDK available at the top of the Changlog. Note: You will need to request permission to download our SDK from the Google Drive, if you don’t already have access
Before you begin you will need a kong-config.json
file from Kongregate. This file contains the various keys and IDs required to initialize the Kongregate SDK.
In Unity, select Assets -> Import Package -> Custom Package...
and import Unity/Kongregate.unitypackage
within the Kongregate SDK zip. Import all files. This plugin includes both the Kongregate and Adjust SDKs along with a handful of demo scripts.
Note: some of the demo scripts depends on the Unity Purchasing plugin. You must enable UnityPurchasing before importing the scripts. If you plan to use another In App Purchasing library the demo scripts should still provide a useful reference.
Assets/Plugins/Kongregate/demo/KongregateAnalyticsOnlyScene.unity
is a great first stop to familiarize yourself with how to integrate Adjust and Kongregate Analytics. (KongregateDemoScene.unity
is a demo for a complete integration with the Kongregate Platform. It is not needed for this guide.)
The scene contains a KongregateAPI
Game Object with KongregateInit.cs
and KongAnalyticsOnlyDemo.cs
scripts attached. This is a barebones implementation of the Kongregate and Adjust SDK. You may use this for reference or a starting point for your own Kongregate API Game Object.
In the Unity Inspector drag your kong-config.json
file into the Config JSON property associated with the KongregateInit
demo script.
Since the Kongregate and Adjust SDKs are native plugins for iOS and Android, they will only work when run on actual devices or simulators and not within the Editor.
Here are the steps for integrating the Kongregate SDK into your game. See KongAnalyticsOnlyDemo.cs
for a sample implementation.
KongregateInit.cs
script to host the Kongregate API. You may use KongAnalyticsOnlyDemo.cs
as a starting point.kong-config.json
into your Asset Tree and set as the Config JSON
property of your Kongregate API game object.In the Game Objects Start()
method set the common properties callback (KongregateInit.SetCommonPropsCallback()). Implement the callback to retrieve properties from your game to included with all events. The fields to include are detailed in the schema provided in the integration welcome email. Entries with Table Name COMMON FIELDS and SDK Input as Callback should be returned by your callback.
KongregateInit.SetCommonPropsCallback(CommonPropsCallback);
installreferrer
, play-services-ads-identifier
, and support-v4
libraries. If your game uses Google Play Game Services Unity Plugin then you should be all set. Our plugin includes /Assets/Kongregate/Editor/Dependencies.xml
which is read and resolved by the PlayServicesResolver
included with the Google Play Services Plugin. If you disabled auto-resolve, you may need to run Assets->Play Services Resolver->Android Resolver->Resolver
. If you are not using the Google Play Services Plugin and need to pull over these archives, you can find Adjust Instruction’s Here.Follow the steps in the Sending Events Guide to properly track all the events provided in your schema.
By default all analytics are sent to sandbox locations. There are two options to eanble release candidate builds which will send analytics data to production databases.
ReleaseCandidate
property in kong-config.json
to true
.RELEASE_CANDIDATE
Scripting Defind Symbol in your Player Settings. This will take precedent over any value set in kong-config.json