尽量观看英文版本,AppsFlyer有点坑中文版有的内容不显示
官方文档:
https://support.appsflyer.com/hc/en-us/categories/201114756-SDK-integration-
主要内容看官方文档,
demo以及unitysdk下载:GitHub - AppsFlyerSDK/appsflyer-unity-plugin: AppsFlyer Unity Plugin
导入sdk:appsflyer-unity-plugin-6.1.0.unitypackage ,将AppsFlyerObject.prefab 拖入场景
填入devKey (运营人员申请的)appID(包名)即可
打点API:
Dictionary<string, string>
eventValues = new Dictionary<string, string>();
eventValues.Add("number", "1");
AppsFlyer.sendEvent("ad_show", eventValues);
有关onConversionDataSuccess的信息,回掉信息解析,
using AppsFlyerSDK;
public class AppsFlyerObjectScript : MonoBehaviour , IAppsFlyerConversionData
{
void Start()
{
/* AppsFlyer.setDebugLog(true); */
AppsFlyer.initSDK("devkey", "appID", this);
AppsFlyer.startSDK();
}
public void onConversionDataSuccess(string conversionData)
{
AppsFlyer.AFLog("onConversionDataSuccess", conversionData);
Dictionary<string, object> conversionDataDictionary = AppsFlyer.CallbackStringToDictionary(conversionData);
// add deferred deeplink logic here
}
public void onConversionDataFail(string error)
{
AppsFlyer.AFLog("onConversionDataFail", 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);
}
}
使用AppsFlyer SDK获取数据转换
Dictionary<string, object> conversionDataDictionary = AppsFlyer.CallbackStringToDictionary(conversionData);
Get AppsFlyer ID
string AppsFlyerUID = AppsFlyer.getAppsFlyerId();
Set customer user ID(设置用户/账户 id )与其他统计平台对应(唯一id)
AppsFlyer.setCustomerUserId("someId");
如无服务器则需自己生成唯一id(Android studio写)
public String GetID(){
String serial = null;
String m_szDevIDShort = "35" +
Build.BOARD.length()%10+ Build.BRAND.length()%10 +
Build.CPU_ABI.length()%10 + Build.DEVICE.length()%10 +
Build.DISPLAY.length()%10 + Build.HOST.length()%10 +
Build.ID.length()%10 + Build.MANUFACTURER.length()%10 +
Build.MODEL.length()%10 + Build.PRODUCT.length()%10 +
Build.TAGS.length()%10 + Build.TYPE.length()%10 +
Build.USER.length()%10 ; //13 位
try {
serial = Build.class.getField("SERIAL").get(null).toString();
//API>=9 使用serial号
return new UUID(m_szDevIDShort.hashCode(), serial.hashCode()).toString();
} catch (Exception exception) {
//serial需要一个初始化
serial = "serial"; // 随便一个初始化
}
return new UUID(m_szDevIDShort.hashCode(), serial.hashCode()).toString();
//使用硬件信息拼凑出来的15位号码
}
注意内容:
问题1、提示AppsFlyer_Unity_v6.0.7 提示 didReceiveConversionDataWithError called with Error connection to server: 400
找运营操作,可能是id未加入测试
问题2、OAID自动获取,unitysdk里面没有具体描述只写了自动获取,但没有加入以下模块无法获取出来
https://support.appsflyer.com/hc/en-us/articles/360006278797-Android-OAID-implementation-in-the-SDK
根据SDK版本选择一种收集方法。Ť他必须开发一个DD制造商的独立JAR文件,应用程序或将其添加到AppsFlyer OAID SDK。
- 将MSA联盟提供 的oaid_sdk_1.0.23.aar下载 到您的模块libs文件夹中(https://github.com/AppsFlyerSDK/appsflyer-oaid/blob/master/oaid/libs/oaid_sdk_1.0.23.aar)
- 添加OAID依赖关系;他们必须在应用程序级别的build.gradle文件中支持制造商的独立JAR文件:
implementation 'com.appsflyer:af-android-sdk:5.4.3@aar'//已包含:af-android-sdk就不用
implementation 'com.appsflyer:oaid:6.1.1'
implementation files('libs/oaid_sdk_1.0.23.aar')
要在AppsFlyer SDK版本V5.4.0中收集OAID,请执行以下操作:
默认情况下会自动收集OAID。
要在AppsFlyer SDK版本V5.2.0和V5.3.0中收集OAID,请执行以下操作:
先致电setCollectOaid()
再致电startTracking()
。
在代码中,调用 AppsFlyerLib.getInstance().setCollectOaid(true);
问题3、AF的混淆代码
在(AS里的)proguard-unity.txt中加入
#appsflyer
-dontwarn com.appsflyer.**
-keep class com.appsflyer.** { *; }
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。