Unity

Appnext Android Tracking SDK Plugin for Unity

The Tracking SDK tracks your app installs, when you promote your apps with Appnext.
You can also use the tracking SDK to send Appnext post-install analytics on your users. This will allow you to measure the quality of the users you’ve acquired through Appnext, analyze the effectiveness of your ad campaigns, and improve ad performance.

Tracking SDK Integration

(updated on 26/12/17)

Integrating Appnext Tracking SDK to Your Android Game

The process of integrating Appnext is fairly straightforward and does not require advanced programming.

The required steps for using Appnext in your applications are outlined below:

  • Add the AAR file to your assets folder
  • Verify your manifest
  • Add tracking code

Step 1: Add the Files to Your Assets Folder

Download the AAR file from here

Add the AppnextTrackingSDK.aar file to your desired project folder. (You can follow this link to understand how)

Step 2: Verify the AndroidManifest.xml file

To properly use Appnext, you need to make sure you allow internet permission in your manifest:

<uses-permission android:name="android.permission.INTERNET"/>

In order to track your app installs, verify that the following code is added your application tag in the manifest file

<receiver android:name="com.appnext.tracking.ReferralReceiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER"/>
</intent-filter>
</receiver>

❗️

We will only track installs that come from Appnext ads, and will not count installs from other sources.

Make sure Appnext's receiver is the first receiver. We will call all the rest from our library.

Step 3: Add Tracking Code

Add this code to your first MonoBehaviour (or to your application class if you have one):

AndroidJavaObject playerActivityContext = null; 
using (var actClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer")) { 
	playerActivityContext = actClass.GetStatic<AndroidJavaObject>("currentActivity");
}
using (var pluginClass = new AndroidJavaClass("com.appnext.tracking.AppnextTrack")) {
	pluginClass.CallStatic ("track", playerActivityContext);
}

Step 4: ProGuard (optional)

Exclude Appnext from your proguard by using the line:

-keep class com.appnext.** { *; }

Integration Support

Should you have any problems integrating the product, log a ticket with us by emailing [email protected]