66 lines
No EOL
1.9 KiB
C#
66 lines
No EOL
1.9 KiB
C#
using AppsFlyerSDK;
|
|
using UnityEngine;
|
|
|
|
// This class is intended to be used the the AppsFlyerObject.prefab
|
|
|
|
public class AppsFlyerObjectScript : MonoBehaviour, IAppsFlyerConversionData
|
|
{
|
|
// These fields are set from the editor so do not modify!
|
|
//******************************//
|
|
public string devKey;
|
|
public string appID;
|
|
public string UWPAppID;
|
|
public string macOSAppID;
|
|
public bool isDebug;
|
|
|
|
public bool getConversionData;
|
|
//******************************//
|
|
|
|
|
|
private void Start()
|
|
{
|
|
// These fields are set from the editor so do not modify!
|
|
//******************************//
|
|
AppsFlyer.setIsDebug(isDebug);
|
|
#if UNITY_WSA_10_0 && !UNITY_EDITOR
|
|
AppsFlyer.initSDK(devKey, UWPAppID, getConversionData ? this : null);
|
|
#elif UNITY_STANDALONE_OSX && !UNITY_EDITOR
|
|
AppsFlyer.initSDK(devKey, macOSAppID, getConversionData ? this : null);
|
|
#else
|
|
AppsFlyer.initSDK(devKey, appID, getConversionData ? this : null);
|
|
#endif
|
|
//******************************/
|
|
|
|
AppsFlyer.startSDK();
|
|
}
|
|
|
|
|
|
private void Update()
|
|
{
|
|
}
|
|
|
|
// Mark AppsFlyer CallBacks
|
|
public void onConversionDataSuccess(string conversionData)
|
|
{
|
|
AppsFlyer.AFLog("didReceiveConversionData", conversionData);
|
|
var conversionDataDictionary = AppsFlyer.CallbackStringToDictionary(conversionData);
|
|
// add deferred deeplink logic here
|
|
}
|
|
|
|
public void onConversionDataFail(string error)
|
|
{
|
|
AppsFlyer.AFLog("didReceiveConversionDataWithError", error);
|
|
}
|
|
|
|
public void onAppOpenAttribution(string attributionData)
|
|
{
|
|
AppsFlyer.AFLog("onAppOpenAttribution", attributionData);
|
|
var attributionDataDictionary = AppsFlyer.CallbackStringToDictionary(attributionData);
|
|
// add direct deeplink logic here
|
|
}
|
|
|
|
public void onAppOpenAttributionFailure(string error)
|
|
{
|
|
AppsFlyer.AFLog("onAppOpenAttributionFailure", error);
|
|
}
|
|
} |