Analytics Only Unity Quick Start

This Guide details how to integrate Kongregate and Adjust Analytics into your Unity Game.

Download the Kongregate SDK

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

Request kong-config.json from Kongregate

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.

Import Kongregate SDK Plugin

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.

Kongregate Plugin Demo Scripts

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.

Enable Kongregate and Adjust in Your Game!

Here are the steps for integrating the Kongregate SDK into your game. See KongAnalyticsOnlyDemo.cs for a sample implementation.

  1. Create an empty Game Object and attach the KongregateInit.cs script to host the Kongregate API. You may use KongAnalyticsOnlyDemo.cs as a starting point.
  2. Drag kong-config.json into your Asset Tree and set as the Config JSON property of your Kongregate API game object.
  3. 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);
    
  4. Android Only: Kongregate and Adjust SDKs require the 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.

Sending Events

Follow the steps in the Sending Events Guide to properly track all the events provided in your schema.

Release Candidates

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.

  1. Change the ReleaseCandidate property in kong-config.json to true.
  2. Set a RELEASE_CANDIDATE Scripting Defind Symbol in your Player Settings. This will take precedent over any value set in kong-config.json