1.1 嵌入 AppsFlyer SDK 至您的项目
将 AF-Android-SDK.jar (在此处下载) 添加到项目的类路径 (class path)。
1.2 设置权限
AndroidManifest.xml 应包括以下权限: <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" /> * * READ_PHONE_STATE 权限是可选的。 添加此权限将启用 IMEI 载波跟踪(谷歌电子市场外的跟踪需要)。1.3 在 AndroidManifest.xml 设置安装 Referrer 广播接收器
<receiver android:name="com.appsflyer.MultipleInstallBroadcastReceiver" android:exported="true"> <intent-filter> <action android:name="com.android.vending.INSTALL_REFERRER" /> </intent-filter> </receiver> <receiver android:name="com.appsflyer.AppsFlyerLib" android:exported="true"> <intent-filter> <action android:name="com.android.vending.INSTALL_REFERRER" /> </intent-filter> </receiver>
AppsFlyerLib.setAppsFlyerKey("[Dev_Key]"); AppsFlyerLib.sendTracking(getApplicationContext())1.5 应用内事件追踪 API (可选)
public static void trackEvent(Context context, String eventName, Map eventValues) context – 使用 getApplicationContext() eventName 可为任何字符串。您可在附录 A 中查看推荐应用名称列表。 eventValues 为包含富应用事件的事件参数。您可在附录 A 中查看推荐参数列表 Map<String, Object> eventValue = new HashMap<String, Object>(); eventValue.put(AFInAppEventParameterName.REVENUE,200); eventValue.put(AFInAppEventParameterName.CONTENT_TYPE,"category_a"); eventValue.put(AFInAppEventParameterName.CONTENT_ID,"1234567"); eventValue.put(AFInAppEventParameterName.CURRENCY,"USD"); AppsFlyerLib.trackEvent(content,AFInAppEventType.PURCHASE,eventValue);
1、sendTracking只是通知服务器有一个app 启动,会根据这个方法计算安装;
2、setCustomerUserId只有在调用sendTracking之前才起作用;
3、应用内时间发送时在in app event可以看到报告;
4、安装报告在install查找;
5、app dev key查找方式:
My Apps >YoursAppName> Settings >SDK Integration;
6、分享链接生成: