简单来说:AppsFlyer 每天使用一次无声推送通知来验证仍在用户设备上安装了应用程序,并统计 特定 app 发生的卸载事件,并将它们归因于特定媒体渠道。 AppsFlyer 提供原始卸载数据的方式包括报告导出、Pull API 和 Data Locker。
卸载测量的好处
-
Compare media sources quality
The rate of uninstalls is a metric, which can help compare the quality of the users you acquire from different media sources, campaigns, single ads or countries. -
Protect users privacy
Many advertisers run re-engagement campaigns to retain their users. However, doing so may contradict the app store's terms of use. If this is the case use the uninstall data to remove uninstallers from retargeted audiences.
操作系统
Supporting the Uninstall Measurement feature requires some development in your apps.
Here are the developer instructions for:
提示
有多少用户卸载应用程序?何时卸载的?
在此处获取完整的类别/国家/地区细分。
重要
截至 2018 年 4 月 10 日, Google 已弃用 GCM。自2019年5月29日起不推荐使用GCM服务器和客户端API。
如果要在新应用中集成消息传递,请使用 FCM。
If you use GCM, upgrade to FCM. After you upgrade to FCM follow the instructions in this article to setup uninstall measurement for Android.
按照 Google 的文档了解更多信息:
安卓卸载测量
Android SDK 版本4.7.0及以上支持使用 Firebase 消息进行卸载监测。
1. 获取 Firebase/GCM 服务器密钥
- 创建一个Firebase安卓应用项目(如果已完成),或者把您的项目从Google Developer Console中迁出(按照下列步骤说明)想了解更多信息,请访问Firebase。
- 打开 Firebase Console.
- 在Firebase 控制台页面,导航至项目设置(点击项目总览旁边的设置图标)。
- In the Cloud Messaging tab, you can see the two Server Keys (see screenshot below):
- 复制该服务器密钥。
2. 在 AppsFlyer 控制面板上输入服务器密钥
- 转到 AppsFlyer 平台上的控制面板。
- 选择左侧菜单上的应用设置。
- 用复制的服务器密钥设置 Firebase 服务器密钥。
3. 在应用上配置 Firebase-Messaging
- 从Firebase console下载google-services.json。
- 把 google-services.json添加到您应用的模块目录中,
- 将规则添加到您的 root-level build.gradle文件, 包括 google-services 插件:
buildscript { // ... dependencies { // ... classpath 'com.google.gms:google-services:4.2.0' // google-services plugin } }
- 将 FCM dependency 添加到 app-level build.gradle file:
dependencies { implementation 'com.google.firebase:firebase-messaging:17.3.4' } // ADD THIS AT THE BOTTOM apply plugin: 'com.google.gms.google-services
The latest Firebase version can be found here: Firebase official doc.
如果您收到"找不到..."错误,请确保您在 Android SDK 管理器中有最新的 Google Repository。
4. 实施 AppsFlyer 卸载测量服务
如果开发人员将 FCM 集成为唯一的测量卸载目的,则可以使用appsFlyer.FirebaseMessagingServiceListener服务,包含在我们的 SDK 中。
这是通过将服务添加到 AndroidManifest.xml:
<application
<!-- ... -->
<service
android:name="com.appsflyer.FirebaseMessagingServiceListener">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<!-- ... -->
</application>
appsflyer.FirebaseInstanceIdListener 扩展 Firebase 的 < > FirebaseInstanceIdService class, 用于接收 Firebase 的设备秘钥。
这是通过扩展 InstanceIDListenerService 的一个新实例 (类似于 AppsFlyer SDK 扩展的服务) 来实现的:
import com.appsflyer.AppsFlyerLib;
import com.google.firebase.messaging.FirebaseMessagingService;
public class MyNewFirebaseManager extends FirebaseMessagingService {
@Override
public void onNewToken(String s) {
super.onNewToken(s);
// Sending new token to AppsFlyer
AppsFlyerLib.getInstance().updateServerUninstallToken(getApplicationContext(), s);
// the rest of the code that makes use of the token goes in this method as well
}
}
该服务应添加到AndroidManifest.xml中才能正常工作:如果应用在集成AppsFlyer SDK之前已使用FCM,则很可能该服务已被扩展,开发人员只需将以下内容添加到 onNewToken()
方法:
AppsFlyerLib.getInstance().updateServerUninstallToken(getApplicationContext(), refreshedToken);
还请确保您已将相关服务添加到 AndroidManifest.xml:
<service
android:name=".MyNewFirebaseManager">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
解决 Android 卸载推送通知没有静默推送的问题
覆盖 Firebase的onMessageReceived
方法并在其中应用您自己的逻辑可能会导致卸载推送通知并没有静默推送。这可能会影响用户体验。为防止这种情况,请检查消息是否包含af-uinstall-tracking
。请参见以下示例:
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
if(remoteMessage.getData().containsKey("af-uinstall-tracking")){
return;
} else {
// handleNotification(remoteMessage);
}
}
5. 使用带有卸载测量功能的 ProGuard
如果您使用的是ProGuard,请添加下列规则:
-dontwarn com.appsflyer.**
-keep public class com.google.firebase.messaging.FirebaseMessagingService {
public *;
}
6. 测试安卓卸载测量
The Uninstalls metric is available in the Overview dashboard.
The list of users who uninstall the app is available in the uninstalls raw-data report.
To test Android uninstall measurement:
- 安装 app。
-
Uninstall the app. Note! You can uninstall the app immediately after installing it.
The uninstall event registers within 24 hours as uninstall measurement is processed daily.
If the app is reinstalled during this time - no uninstall event is recorded.
The app uninstall event takes up to 48 hours to show up in the raw-data reports and in the Aggregated Performance Report in your AppsFlyer dashboard.
Whether the Android app is live on Google Play, pending submission, or even out of store - the test is the same.
注意
AppsFlyer iOS 卸载事件数据取决于 Apple 推送通知服务 (APN)。出于隐私方面的考虑,只有在安装后至少八天后,APN才会在用户删除应用程序是进行实时报告。这意味着iOS卸载数据仅在第8天之后可见。
点击此处了解详情!
iOS 卸载测量
重要信息!
若要使用此功能,SDK 版本至少要是4.5.0或更高版本。如果要评估iOS 13及更高版本上的卸载,则必须具有最低SDK版本4.10.4及更高版本。
此功能还需要 p12 证书。不支持 p8 证书。
注意
对于拒绝推送通知权限的用户, 无法进行卸载测量。
1. 查找您的应用程序
2. 如果您尚未注册应用 ID,请单击 + 符号并填写表单。
3. 选中"推送通知"复选框。
4. 展开应用程序时,有两种带有黄色或绿色状态图标的推送通知设置:
5. 单击"设置"以继续。
注意
如果以前已配置推送通知,则"设置"按钮可能标题为"编辑"。如果"设置/编辑"按钮不可用,则您可能不是团队代理或管理员。最初创建开发人员帐户的人员是您的团队代理,他们执行本节中其余步骤。
2. 生成证书
1. 在生产证书选项中选择 Apple推送通知 SSL (Sandbox & Production) 。如果有在推送通知中使用 VoIP,请选择 VoIP服务证书。
2. 单击"从生产 SSL 证书创建证书"选项。
3. 单击"创建证书"后,请注意添加 iOS Certificate Assistant。按照助手中的说明操作,然后单击"继续"。
4. 使用刚刚创建的证书签名请求,生成 APNS 推送 SSL 证书。
5. 下载按钮出现后,即可下载。您可能需要重新加载页面才能更新。下载新创建的证书:
6. 打开证书。打开证书将打开钥匙串访问。
在"Keychain Access"中,您的证书显示在我的证书下。如果没有,请检查证书以查看该证书是否存在。
注意
只有帐户管理员可以上传或更改 p12 证书。
3. 更新您的证书
如果要续订 Development 或者 Production Push SSL 证书, 请按照上面列出的步骤操作, 就像您是第一次上传证书一样。无需撤消以前的证书即可进行此更改。可能同时有两个生产证书, 以允许您在上传新证书时继续使用旧证书。
4. 导出 P12文件
返回 AppsFlyer 控制面板之前的最后一步是将签名证书另存为 .p12。
1. 选择刚刚添加到钥匙串访问的证书
2.转到文件 > 导出项目 。
3. 在左下边的"类别"菜单下选择"我的证书"。
如果未突出显示"我的证书",则无法将证书导出为 .p12文件。
3. 保存文件时,使用 Personal Information Exchange (.p12)格式。
4. 确保它符合 Apple Push Services ,如下所示:
5. 转到 AppsFlyer 平台上的控制面板。
6.在左侧菜单上选择“ 应用程序设置” 。
7.单击上传图标,选择要上传的P12文件。
8. (可选) 如果 P12 证书 受密码保护,请填写P12 证书密码中的密码 。
9. 单击验证将证书发送到 AppsFlyer 以检查其是否有效。
10. 单击保存设置。
5. 与 SDK 集成
推送通知必须在应用的代码级别配置, 以启用卸载数据收集。
//add UserNotifications.framework
import UserNotifications
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
//...
// iOS 10 support
if #available(iOS 10, *) {
UNUserNotificationCenter.current().requestAuthorization(options:[.badge, .alert, .sound]){ (granted, error) in }
application.registerForRemoteNotifications()
}
// iOS 9 and iOS 8 support
else if #available(iOS 8, *), #available(iOS 9, *) {
UIApplication.shared.registerUserNotificationSettings(UIUserNotificationSettings(types: [.badge, .sound, .alert], categories: nil))
UIApplication.shared.registerForRemoteNotifications()
}
// iOS 7 support
else {
application.registerForRemoteNotifications(matching: [.badge, .sound, .alert])
}
return true
}
// Called when the application sucessfuly registers for push notifications
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
AppsFlyerTracker.shared().registerUninstall(deviceToken)
}
将以下代码添加到您的 AppDelegate.m:
- #import <UserNotifications/UserNotifications.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// The userNotificationTypes below is just an example and may be changed depending on the app
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
center.delegate = self;
[center requestAuthorizationWithOptions:(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge) completionHandler:^(BOOL granted, NSError * _Nullable error) {
}];
[[UIApplication sharedApplication] registerForRemoteNotifications];
// if you do not use push notificaiton in your app, uncomment the following line
//application.applicationIconBadgeNumber = 0;
}
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
[[AppsFlyerTracker sharedTracker] registerUninstall:deviceToken];
}
}
在 AppDelegate.h 中:插入以下代码以将 UNUserNotificationCenterDelegate 添加到接口声明中:
#import <AppsFlyerLib/AppsFlyerTracker.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate, AppsFlyerTrackerDelegate>
上述代码段需要请求用户权限才可以发送推送通知。但是,如果您仅在后台模式下使用推送通知来衡量卸载情况,则无需请求用户权限。这是因为这个推送消息是静默通知-无需请求用户权限。
后台模式下推送通知的用户权限
如果您仅使用静默推送通知, 请确保在应用的功能中启用后台模式的远程通知:
6. 推送通知
请确保在 XCode 功能选项卡中添加推送通知。如果没有它, deviceToken 将不会被收集。
7. 测试卸载
测试 iOS 卸载监测的步骤:
- 安装 app。
- 卸载 app。 注意!您可以在安装 app 后立即将其卸载。
当从 Xcode 或 TestFlight 测试卸载 时,要注意让我们的 SDK 知道 token 是从沙盒环境生成的。使用以下 API:
AppsFlyerTracker.shared().useUninstallSandbox= true
[AppsFlyerTracker sharedTracker].useUninstallSandbox= true;
注意 卸载不会立即出现在 AppsFlyer 面板中:
- 一般需要需要 平均 9天 才能显示在报告中
- 来自沙盒环境的卸载可能需要 一个月或以上的时间才能显示在报告中
此外,卸载日期是卸载上报的日期。请参阅下一章节以了解更多信息。
8. 在 AppsFlyer 控制面板中查看卸载数据
卸载测量显示在 "汇总业绩" 表中的主控制面板上。
Due to a recent change in Apple Push Notification service, the time it takes uninstalls to appear on the dashboard is a minimum of 9 days. AppsFlyer updates and aggregates metrics for uninstalls every 24 hours
示例
- Day 1 - a user installs your app
- Day 4 - the user uninstalls your app
- Day 12 - Apple Push Notification Service reports app removal 8 days after the uninstall
- Day 13 - Uninstall data appear on AppsFlyer dashboard and raw data
For more details, refer to the iOS Measure App Uninstalls section of the SDK Integration Guide.
卸载事件回传
AppsFlyer enables you to send an uninstall event postback, for every known uninstalling user, to the partners you work with. The uninstall event is called af_uninstall
in AppsFlyer's dashboard.
映射卸载事件
You can map the af_uninstall
event just like mapping any in-app event of your app.
As with any in-app event, AppsFlyer can send the postback only if the event actually occurs and is recorded by AppsFlyer. Therefore, mapping af_uninstall only works for completed uninstall implementations. If you don't see uninstalls in the overview page, or in the uninstalls raw data reports, no uninstall postbacks are sent to partners, even if you have mapped the af_uninstall
event.
af_uninstall
timing
Unlike postbacks for regular in-app events, The af_uninstall
event is not sent in real-time.
In AppsFlyer raw-data and partner postbacks, the af_uninstall
logged event time is the time when AppsFlyer knows about the uninstall.
- For Android devices: 24-48 hours after actual app uninstall
- For iOS devices: 9-11 days after actual app uninstall
限制
af_uninstall 事件未包含在应用内事件回发报告中。
af_uninstall 事件目前不适用于所有合作伙伴。
如果您希望与合作伙伴进行映射,但看到该活动不适用于合作伙伴,请联系您的专用 CSM 或写信给 hello@appsflyer.com。
如果您是合作伙伴, 并希望接收 af_uninstall, 请联系我们的 PDM 或发邮件至 partners@appsflyer.com。