Please enable Javascript to view the contents

使用 Adjust + FCM 追踪卸载和重装

 ·  ☕ 1 分钟

Adjust SDK 无法独自实现追踪卸载和重装,需要借助 FCM SDK 的消息推送功能。

实现原理

官方文档:Uninstall and reinstall measurement

概括起来如下:

  1. FCM 会在新用户首次启动时,为该设备生成一个设备标识符,即 registration token 以下称作 push token,在此应用场景中的作用是消息定位该设备;

  2. Adjust 获取上述 FCM 生成的 push token,并与自己的设备标识相关联;

  3. Adjust 通过 FCM 每天向设备发送一个静默的推送消息用于卸载监听,并根据监听结果来判断用户是否发生了卸载或者重装。


    其中 pushToken 用于定位设备:

    1
    2
    3
    4
    5
    6
    
    {
       "to":"pushToken",
       "data":{
          "adjust_purpose":"uninstall detection"
       }
    }
    
Retrieve push token from FCM(图源 Adjust)
Check app status through FCM daily(图源 Adjust)

具体步骤

  1. 准备 FCM server key,并配置到 Adjust 后台:


    FCM server key config example

  2. 接入 FCM SDK:Set up a Firebase Cloud Messaging client app on Android

  3. Adjust SDK 获取 Push tokens:

    Push tokens are used for Audience Builder and client callbacks. They are also required for uninstall and reinstall tracking.

    1
    2
    
    // Send the token with context (recommended)
    Adjust.setPushToken(pushNotificationsToken, context);
    
分享

Molly Wang
作者
Molly Wang
一个数据产品人的自我修养