/// <summary> /// Initialize the AppsFlyer SDK with your devKey and appID. /// The dev key is required on all platforms, and the appID is required for iOS. /// If you app is for Android only pass null for the appID. /// </summary> /// <param name="devKey"> AppsFlyer's Dev-Key, which is accessible from your AppsFlyer account under 'App Settings' in the dashboard.</param> /// <param name="appID">Your app's Apple ID.</param> /// <param name="gameObject">pass the script of the game object being used.</param> /// <example> /// <code> /// AppsFlyer.initSDK("K2***********99", 41*****44, this); /// </code> /// </example> public static void initSDK(string devKey, string appID, MonoBehaviour gameObject) { if (gameObject != null) { CallBackObjectName = gameObject.name; } #if UNITY_IOS && !UNITY_EDITOR AppsFlyeriOS.setAppsFlyerDevKey(devKey); AppsFlyeriOS.setAppleAppID(appID); if (gameObject != null) { AppsFlyeriOS.getConversionData(gameObject.name); } #elif UNITY_ANDROID && !UNITY_EDITOR AppsFlyerAndroid.initSDK(devKey, gameObject); #elif UNITY_WSA_10_0 && !UNITY_EDITOR AppsFlyerWindows.InitSDK(devKey, appID, gameObject); if (gameObject != null) { AppsFlyerWindows.GetConversionData(gameObject.name); } #else #endif }
/// <summary> /// Once this API is invoked, our SDK will start. /// Once the API is called a sessions will be immediately sent, and all background forground transitions will send a session. /// </summary> public static void startSDK() { #if UNITY_IOS && !UNITY_EDITOR AppsFlyeriOS.startSDK(onRequestResponse != null, CallBackObjectName); #elif UNITY_ANDROID && !UNITY_EDITOR AppsFlyerAndroid.startSDK(onRequestResponse != null, CallBackObjectName); #elif UNITY_WSA_10_0 && !UNITY_EDITOR AppsFlyerWindows.Start(); #endif }
/// <summary> /// Send an In-App Event. /// In-App Events provide insight on what is happening in your app. /// </summary> /// <param name="eventName">Event Name as String.</param> /// <param name="eventValues">Event Values as Dictionary.</param> public static void sendEvent(string eventName, Dictionary <string, string> eventValues) { #if UNITY_IOS && !UNITY_EDITOR AppsFlyeriOS.sendEvent(eventName, eventValues, onInAppResponse != null, CallBackObjectName); #elif UNITY_ANDROID && !UNITY_EDITOR AppsFlyerAndroid.sendEvent(eventName, eventValues, onInAppResponse != null, CallBackObjectName); #elif UNITY_WSA_10_0 && !UNITY_EDITOR AppsFlyerWindows.LogEvent(eventName, eventValues); #else #endif }
/// <summary> /// Register a Conversion Data Listener. /// Allows the developer to access the user attribution data in real-time for every new install, directly from the SDK level. /// By doing this you can serve users with personalized content or send them to specific activities within the app, /// which can greatly enhance their engagement with your app. /// </summary> /// <example> /// <code> /// AppsFlyer.getConversionData(this.name); /// </code> /// </example> public static void getConversionData(string objectName) { #if UNITY_IOS && !UNITY_EDITOR AppsFlyeriOS.getConversionData(objectName); #elif UNITY_ANDROID && !UNITY_EDITOR AppsFlyerAndroid.getConversionData(objectName); #elif UNITY_WSA_10_0 && !UNITY_EDITOR AppsFlyerWindows.GetConversionData(""); #else #endif }
/// <summary> /// Setting your own customer ID enables you to cross-reference your own unique ID with AppsFlyer’s unique ID and the other devices’ IDs. /// This ID is available in AppsFlyer CSV reports along with Postback APIs for cross-referencing with your internal IDs. /// </summary> /// <param name="id">Customer ID for client.</param> public static void setCustomerUserId(string id) { #if UNITY_IOS && !UNITY_EDITOR AppsFlyeriOS.setCustomerUserID(id); #elif UNITY_ANDROID && !UNITY_EDITOR AppsFlyerAndroid.setCustomerUserId(id); #elif UNITY_WSA_10_0 && !UNITY_EDITOR AppsFlyerWindows.SetCustomerUserId(id); #else #endif }
/// <summary> /// Get AppsFlyer's unique device ID which is created for every new install of an app. /// </summary> /// <returns>AppsFlyer's unique device ID.</returns> public static string getAppsFlyerId() { #if UNITY_IOS && !UNITY_EDITOR return(AppsFlyeriOS.getAppsFlyerId()); #elif UNITY_ANDROID && !UNITY_EDITOR return(AppsFlyerAndroid.getAppsFlyerId()); #elif UNITY_WSA_10_0 && !UNITY_EDITOR return(AppsFlyerWindows.GetAppsFlyerId()); #else return(""); #endif }