// Use this for initialization void Start() { //Mandatory - set your AppsFlyer’s Developer key. AppsFlyer.setAppsFlyerKey("ZmysHsNw9VtBeDmP4maYab"); // // For detailed logging //AppsFlyer.setIsDebug (true); #if UNITY_IOS //Mandatory - set your apple app ID AppsFlyer.setAppID("YOUR_APP_ID_HERE"); AppsFlyer.trackAppLaunch(); #elif UNITY_ANDROID //Mandatory - set your Android package name AppsFlyer.setAppID(Application.bundleIdentifier); AppsFlyer.init("ZmysHsNw9VtBeDmP4maYab"); AppsFlyer.setGCMProjectNumber("60588766610"); #endif //For getting the conversion data in Android, you need to this listener. AppsFlyer.loadConversionData(name, "didReceiveConversionData", "didReceiveConversionDataWithError"); AppsFlyer.createValidateInAppListener(name, "onInAppBillingSuccess", "onInAppBillingFailure"); string[] keys; string[] values; if (!PlayerPrefs.HasKey("AppsFlyAnalytics")) { PlayerPrefs.SetInt("AppsFlyAnalytics", 1); keys = new string[] { "status" }; values = new string[] { "new" }; TrackEvent("NewUser", keys, values); } }
// Use this for initialization void Start() { Application.runInBackground = true; Screen.orientation = ScreenOrientation.Portrait; DontDestroyOnLoad(this); AppsFlyer.setIsDebug(true); #if UNITY_IOS AppsFlyer.setAppsFlyerKey("YOUR_DEV_KEY"); AppsFlyer.setAppID("YOUR_APP_ID"); AppsFlyer.setIsDebug(true); AppsFlyer.getConversionData(); AppsFlyer.trackAppLaunch(); // register to push notifications for iOS uninstall UnityEngine.iOS.NotificationServices.RegisterForNotifications(UnityEngine.iOS.NotificationType.Alert | UnityEngine.iOS.NotificationType.Badge | UnityEngine.iOS.NotificationType.Sound); Screen.orientation = ScreenOrientation.Portrait; #elif UNITY_ANDROID AppsFlyer.init("YOUR_DEV_KEY"); AppsFlyer.setAppID("YOUR_APP_ID"); // for getting the conversion data AppsFlyer.loadConversionData("StartUp"); // for in app billing validation // AppsFlyer.createValidateInAppListener ("AppsFlyerTrackerCallbacks", "onInAppBillingSuccess", "onInAppBillingFailure"); //For Android Uninstall AppsFlyer.setGCMProjectNumber("YOUR_GCM_PROJECT_NUMBER"); #endif }
public override System.Collections.Generic.IEnumerator <byte> Auth(string key, ServiceItem serviceItem) { #if APPSFLYER_ANALYTICS_API AppsFlyer.setIsDebug(this.isDebug); AppsFlyer.setAppsFlyerKey(key); #if UNITY_IOS AppsFlyer.setAppID(this.iosAppId); AppsFlyer.trackAppLaunch(); AppsFlyer.getConversionData(); UnityEngine.iOS.NotificationServices.RegisterForNotifications(UnityEngine.iOS.NotificationType.Alert | UnityEngine.iOS.NotificationType.Badge | UnityEngine.iOS.NotificationType.Sound); #elif UNITY_ANDROID AppsFlyer.setAppID(this.androidAppId); AppsFlyer.init(this.androidDevKey); AppsFlyer.setGCMProjectNumber(this.androidGCMProjectNumber); #endif #endif yield return(0); }