AppsFlyerObjectScript.cs
1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using AppsFlyerSDK;
// 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 bool isDebug;
public bool getConversionData;
//******************************//
void Start()
{
// These fields are set from the editor so do not modify!
//******************************//
AppsFlyer.setIsDebug(isDebug);
AppsFlyer.initSDK(devKey, appID, getConversionData ? this : null);
//******************************//
AppsFlyer.startSDK();
}
void Update()
{
}
// Mark AppsFlyer CallBacks
public void onConversionDataSuccess(string conversionData)
{
AppsFlyer.AFLog("didReceiveConversionData", conversionData);
Dictionary<string, object> 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);
Dictionary<string, object> attributionDataDictionary = AppsFlyer.CallbackStringToDictionary(attributionData);
// add direct deeplink logic here
}
public void onAppOpenAttributionFailure(string error)
{
AppsFlyer.AFLog("onAppOpenAttributionFailure", error);
}
}