Skip to content
This repository has been archived by the owner on Dec 6, 2022. It is now read-only.

Latest commit

 

History

History
executable file
·
90 lines (51 loc) · 3.07 KB

README.md

File metadata and controls

executable file
·
90 lines (51 loc) · 3.07 KB

AppsFlyer Unity Sample App

Instructions for AppsFlyer's Unity Sample App project:

Open the Sample App Project using Unity.

Inside "Sample" folder, open "StartUp.cs".

In "StartUp.cs", enter your AppsFlyer Dev Key inside the "init"/"setAppsFlyerKey" function, and your Package Name / AppID inside "setAppID" function" -


using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AppsFlyerObject : MonoBehaviour {
   void Start () {
   
   /* Mandatory - set your AppsFlyer’s Developer key. */
   AppsFlyer.setAppsFlyerKey ("YOUR_APPSFLYER_DEV_KEY");
   /* For detailed logging */
   /* AppsFlyer.setIsDebug (true); */
   
   #if UNITY_IOS
   
      /* Mandatory - set your apple app ID
      NOTE: You should enter the number only and not the "ID" prefix */
      AppsFlyer.setAppID ("YOUR_APP_ID_HERE");
      AppsFlyer.getConversionData();
      AppsFlyer.trackAppLaunch ();
      
   #elif UNITY_ANDROID
   
     /* For getting the conversion data in Android, you need to add the "AppsFlyerTrackerCallbacks" listener.*/
     AppsFlyer.init ("YOUR_APPSFLYER_DEV_KEY","AppsFlyerTrackerCallbacks");
     
  #endif
   }
}

Android: Change the project's package name in Player Setting.

iOS: Make sure to that Security.framework is added to XCode

Go to your AppsFlyer dashboard and add the app using the Package Name / App ID you configured in the code.

Create a custom tracking link from your AppsFlyer dashboard - More Information

Click the link on your device (Make sure to add &advertising_id="Your_Device_Google_Advertising_Id" for Android or &IDFA="Your_Device_IDFA" for iOS at the end of your tracking link). More Information

Install the App on your device. You should be seeing the Attribution result on the screen.

If you received the "Install Type: Non Organic" message on the app, you can go to your AppsFlyer dashboard and see the non-organic install there.

For a Non-Organic install - click the "Track Event" to track a custom purchase event. You can then see the revenue and event on your AppsFlyer dashboard.

iOS Integration Guide.

Android Integration Guide.

Screen Shots