<uses-permission android:name="com.google.android.gms.permission.AD_ID"/> Please ensure this permission is added to your AndroidManifest.xml in order for ADID collection to continue to take place as of API 31 and beyond.
Some Google Play policies, such as the Families Policy, require that apps not use the ADID. In those cases this permission should not be included as the ADID should not be collected.
Integrating the SDK
- Unity version 2017.4 or higher
- Android API 14
- Xcode 12.4
NOTE: Google has deprecated their legacy Play Install Referrer API which utilized a broadcast receiver. The updated version requires that the library com.android.installreferrer:installreferrer:1.0 be added to replace it. Our native Android SDK Integration documentation describes this change in more detail.
- Windows Desktop
- Windows Store (UWP)
- VR Hardware:
- Oculus Rift
- HTC Vive
- Samsung Gear VR
- Google Daydream
NOTE: Unity Cloud build is supported for all platforms.
If you are migrating from a Kochava SDK version prior to version 4.2.0 then follow the migration steps outlined in the migration guide before proceeding with integrating the current SDK.
In order to use the Kochava SDK, first add it within your project. This can be accomplished by downloading the SDK and importing it.
- Download the KochavaTrackerUnity.unitypackage file from the download badge above.
- Drag and drop the unitypackage into the Assets folder of your project.
Google Play Services:
The Kochava SDK requires the Google Play Services “play-services-ads-identifier” and its dependencies which at this time includes “play-services-basement”. These files should be added within the Assets > Plugins > Android folder.
//Required: ADID collection as of API 31+
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.
In order to gather the Install Referrer the Kochava SDK requires the Google Play Install Referrer Library dependency. This file should be added within the Assets > Plugins > Android folder.
The Kochava SDK also gathers the legacy broadcast receiver based Install Referrer. In a typical project the broadcast receiver is automatically merged from the AAR package in the Kochava SDK into your manifest. If you are using an overridden manifest file then add this to your block to receive the legacy install referrer from the Google Play Store.
<receiver android:name ="com.kochava.base.ReferralReceiver"
<action android:name ="com.android.vending.INSTALL_REFERRER" />
Removing the Legacy Receiver:
If you have upgraded from an SDK version prior to 3.x and are using an overridden manifest, any legacy broadcast receiver entry must be removed from your AndroidManfiest.xml file. Failure to do so may result in crashes experienced only in production and not during development or testing.
Please ensure the following receiver has been removed from the AndroidManfiest.xml file:
<action android:name="com.android.vending.INSTALL_REFERRER" />
The SDK requires several additional frameworks as listed below. When using the default Xcode build settings you generally do not need to add these frameworks manually, but if you’ve disabled automatic linking, then you may also need to add the following to your Linked Frameworks and Libraries.
The Windows Store (UWP) platform requires the following player settings.
- API Compatibility Level: .NET 4.6
- Permissions: Internet
Starting the Tracker
Once you have added the Kochava SDK to your project, the next step is to configure and start the Kochava Tracker. Only your App GUID is required to start the tracker with the default settings, which is the case for typical integrations.
We recommend placing the Kochava Configuration Prefab in your launch scene, although this can be done elsewhere if needed. Starting the tracker as early as possible will provide more accurate session reporting and help to ensure the tracker has been started before using it. Keep in mind the tracker can only be configured and started once per launch.
The Kochava Configuration object will automatically start the Kochava SDK during the Awake lifecycle stage. Calls to the SDK should not be made until after this has occurred. The simplest way to ensure this is to not make any calls to the SDK until the Start lifecycle stage or later.
Confirm the Integration
After integrating the SDK and adding the code to start the tracker, launch and run the app for at least 10 seconds or more. During this time the tracker will start and send an install payload to Kochava. To confirm integration was successful, visit the app’s Install Feed Validation page Apps & Assets > Install Feed Validation. On this page you should see one of two integration messages, indicating integration success or failure.
Along with this message you will also see a variety of data points associated with the device used for testing. At this point your integration is successful and you can proceed to the next step(s).
NOTE: It may take a few minutes for the first install to appear within the Install Feed Validation page. If you do not see this message immediately, you may simply need to wait a few minutes and check again.
Integration Not Complete:
If you encounter this message, please review the integration steps, uninstall and reinstall the app, and check again.
Where to Go From Here:
Now that you have completed integration you are ready to utilize the many features offered by the Kochava SDK. Continue on to Using the SDK and choose a topic.
Custom Tracker Configuration
If you would like to make adjustments to the tracker configuration beyond the default settings, set your App GUID and the desired parameters and then pass it to the tracker’s configure method.
Using a Custom Configuration:
NOTE: Setting values within the KochavaConfiguration inspector view or the Kochava.Tracker.Config object will have no effect after the tracker has been started.
Below is a list of all configuration options and their default settings. Keep in mind that in a typical integration these configuration settings should not be adjusted from their default values.
Default — None
This string should be set to your Kochava App GUID, which can be found in your Edit App page within the Kochava dashboard. This value is always required (unless a Partner Name is set).
An individual Kochava App should be created for each published platform and its App GUID placed in its appropriate spot in the inspector. The Unity Editor App GUID will be used within the Editor and for any platform that a specific App GUID was not specified.
Default — None
Provide an attribution event listener if you wish to be notified of attribution results from Kochava servers. This is not necessary unless you wish to parse the attribution results for use within the app. When selecting a listener using the Unity Event Inspector UI ensure you select your method with the “Dynamic string” setting.
For complete details and examples, see: Retrieving Attribution.
Default — None
This is a reserved setting and should not be set unless provided by your Client Success Manager.
Default — None
This is a reserved value and should not be set unless provided by your Client Success Manager.
Default — False
Set this value to true if you wish to start the tracker in Sleep mode. This advanced feature prevents the tracker from sending any network transactions and delays collection of the install data until woken.
For complete details and examples, see: Sleeping the Tracker.
Default — False
Android and iOS Only
As GDPR compliance can present many challenges during development, Kochava offers a fully managed solution for all your GDPR consent requirements through the use of our Intelligent Consent Management feature. By using this feature the Kochava SDK will handle determining when consent is required for any user while shouldering much the GDPR burden for you.
NOTE: This is an advanced feature requiring additional setup within your Kochava dashboard and should not be enabled without a full and complete understanding of how to use the Intelligent Consent Management feature.
For complete details and examples, see: Intelligent Consent Management.