A lightweight and easy to integrate SDK written in C# that for Android and iOS wraps the native SDKs, providing first-class integration with Kochava’s installation attribution and analytics platform.
- Facebook Gameroom
- Windows Desktop
- VR Hardware:
- Oculus Rift
- HTC Vive
- Samsung Gear VR
- Google Daydream
- Unity version 5.0 or higher
- Unity version 2017 for Windows Store (UWP)
- Android API 14
- Xcode 8.0
NOTE: Unity Cloud build is supported for all platforms. The latest iOS SDK is built with Xcode 8.3 for cloud build compatibility.
- Add the SDK into your project.
Launch Unity and import the Kochava_Unity_xxxx.unitypackage file obtained from the download badge above.
Android Add Google Play Services –
NOTE: Starting with Play Services 15 the dependency requirements have changed. The Android Advertising ID (adid) collection has moved out of play-services “base” and into “ads-identifier”.
- Play Services Version 15+:
The Kochava SDK requires the Google Play Services “play-services-ads-identifier” and its dependencies which at this time includes “play-services-basement”.
Older Play Services Versions:
The Kochava SDK requires Google Play Services – Base and Google Play Services – Basement.
- Kochava suggests you add Google Play Services – Location and it’s dependencies as well if you wish to collect location data. These files should all be added within the Assets > Plugins > Android folder. If collecting location you must also add the ACCESS_FINE_LOCATION and ACCESS_COARSE_LOCATION permissions to your android manifest. Below is a sample of how your file structure might look after adding these files.
NOTE: In our testing, using Google Play Services v10.0.1 AARs, we found that Google Play Services – Location additionally required the Support v4 library (“support_compat”), which we added in the sample above. Your mileage may vary depending on which versions you use and how you integrate Google Play Services. For more information on adding Google Play Services, refer to Android support documentation.
Email Attribution –
If enabled in the Kochava dashboard for your app, the Kochava SDK can retrieve email addresses on the device, for use in attribution. If you wish to enable this capability, you need to add the GET_ACCOUNTS permission in your Android manifest
Install Referrer –
In a typical project the install referrer broadcast receiver is automatically merged from the AAR package into your manifest. If you are using an overridden manifest file then add this to your block to receive the install referrer from the Google Play Store:1234567<receiver android:name ="com.kochava.base.ReferralReceiver"android:enabled="true"android:exported ="true"><intent-filter><action android:name ="com.android.vending.INSTALL_REFERRER" /></intent-filter></receiver>
Be aware that there are other frameworks that this SDK requires. With Unity 5.0+, the current version of Xcode, and with the default build settings, you generally do not need to add these frameworks manually to your Linked Frameworks and Libraries. But if you’ve disabled automatic linking, then you may also need to add the following frameworks:
Unity version 2017 or higher is required for targeting the Windows Store (UWP) platform and also requires the following player settings:
- API Compatibility Level: .NET 4.6
- Permissions: Internet
- Play Services Version 15+:
- Configure a Tracker
Kochava can be integrated either through code or by adding the KochavaConfiguration prefab within the UI. For a description of all the configuration options see our Configure reference.
Drag and Drop UI Integration:
- Drag and drop the Assets\Plugins\Kochava\KochavaConfiguration prefab into your scene. This scene should only be loaded once when your application launches.
- Select the newly added KochavaConfiguration object within the scene and enter each applicable Kochava App GUID in the appropriate platform-specific slot. The Unity Editor slot will be used as a default for any platforms not listed. You may also set any other initialization options here, such as a desired log level.
A. Drag and Drop
B. App specific data will be imported.
Code Integration (advanced):
Kochava can optionally be added through code by setting your Kochava App GUID and calling Initialize(). If you choose this route it is up to you to ensure that Kochava is initialized only once and that it survives scene changes. The Initialize() method will automatically create a game object named “KochavaTracker” and call DoNotDestroyOnLoad() on it. Please be aware that setting any Kochava.Tracker.Config values must be done before Kochava.Tracker.Initialize() is called.123Kochava.Tracker.Config.SetAppGuid("_YOUR_APP_GUID_");Kochava.Tracker.Config.SetLogLevel(Kochava.DebugLogLevel.info);Kochava.Tracker.Initialize();
BEST PRACTICES: The Kochava SDK does not require that you modify any code or files within the SDK. Modifying or moving any files within the SDK unity package will break the SDK or result in unexpected behavior.
Using the SDK
More than basic analytics, the events you send to Kochava are associated with your install attribution data, so that you can understand how the users who came to you through a particular ad went on to use the various features within your app. For more information, refer to Sending Post Install Events.
var myEvent = new Kochava.Event(Kochava.EventType.Purchase);
myEvent.price = 1.99f;
myEvent.currency = "USD";
myEvent.name = "Gold Token";
Setting Identity Link:
You can link additional identifying information with an install, where it can be integrated with your analytics. For more information see Setting an Identity Link.
You can retrieve Kochava’s attribution information within your app. For more information see Get Your Attribution Data.
Getting the Device ID:
You can get the unique device identifier used by the tracker. For more information see Get your Kochava Device ID.
Adjusting the Log Level:
You can specify the types of entries which the tracker prints to the log. For more information see Configure Log Level.
Intelligent Consent Management:
When intelligent consent management is enabled and configured within your Kochava dashboard, the SDK will indicate when the user should be prompted for consent. It will also not gather, persist, or transmit data which requires consent unless consent has been granted. For more information refer to Intelligent Consent Management support documentation. For code-level integration see the configuration parameter Intelligent Consent Management.