AppsFlyer
AppsFlyer 是领先的移动归因与营销分析平台,作为第三方服务,负责收集和整理营销活动数据,帮助企业在一处查看各营销活动的投放效果。 Adapty 提供了一套完整的数据,让您可以在一处追踪来自各应用商店的订阅事件。借助 Adapty,您可以轻松了解订阅用户的行为规律、掌握他们的偏好,并据此以精准、高效的方式与他们沟通。因此,本集成使您能够在 AppsFlyer 中追踪订阅事件,并精确分析各广告系列带来的收入。
Adapty 与 AppsFlyer 的集成通过两种主要方式运作。
- 从 AppsFlyer 接收归因数据 一旦你在应用代码中完成将 AppsFlyer 归因数据发送至 Adapty 的配置,Adapty 就会开始从 AppsFlyer 接收归因数据。你可以在用户画像页面上轻松查看这些数据。
- 向 AppsFlyer 发送订阅事件 Adapty 可以将所有在集成中配置的订阅事件发送到 AppsFlyer,让你能够在 AppsFlyer 看板中追踪这些事件。这对于评估广告活动的效果非常有帮助。
配置设置
将 Adapty 连接到 AppsFlyer
按照以下步骤设置与 AppsFlyer 的集成:
-
在 Adapty 看板中打开 Integrations -> AppsFlyer。
-
打开开关以启用集成。
-
接下来需要填写凭据。 对于 iOS,请在 App Store Connect 中找到 Apple ID(方法:在 App Store Connect 中打开你的应用页面,进入 General 部分的 App Information 页面,在屏幕左下角找到 Apple ID)。
3.2. 将复制的 Apple ID 粘贴到 Adapty 看板中的 iOS App ID 字段。
如果你正在使用 AppsFlyer API 2,需要切换到 API 3,因为旧版本即将被 AppsFlyer 废弃。请在 AppsFlyer S2S API 列表中选择 API 3。
- 无论是 iOS 还是 Android,请打开 AppsFlyer 网站 并登录。
- 点击看板右上角的 Your account name -> Security Center。
- 在 Manage your account security 窗口中,点击 Manage your AppsFlyer API and S2S tokens 按钮。
- 如果您已有 S2S 令牌,请直接跳至第 12 步。如果没有,请点击 New token 按钮。
-
在 New token 窗口中,输入令牌名称。该名称仅供您自己参考。
-
在 Choose type 列表中选择 S2S。
-
点击 Create new token 按钮保存新令牌。
-
在 Tokens 窗口中,复制 S2S 令牌。
-
在 Adapty 看板中,将复制的 S2S 密钥粘贴到 Dev key for iOS 和 Dev key for Android 字段中。
-
点击 Save 按钮保存更改。
AppsFlyer 没有用于服务器到服务器集成的沙盒模式。因此,你需要在 AppsFlyer 中为沙盒 Dev Key 使用不同的应用程序/账户。如果你想将沙盒事件发送到同一个应用,直接使用相同的 key 用于生产环境和沙盒环境即可。 :::
Adapty 默认将部分事件映射到 AppsFlyer 的标准事件。通过这样的配置,AppsFlyer 可以将事件转发给你使用的每个广告网络,无需额外设置。 还有一点需要注意:AppsFlyer 不支持超过 26 小时的历史事件。因此,如果某个事件的时间超过 26 小时,Adapty 仍会将其发送给 AppsFlyer,但事件的日期和时间将被替换为当前时间戳。
配置事件和标签
在凭证下方,有三组事件可以从 Adapty 发送到 AppsFlyer。直接开启你需要的事件即可。在这里查看 Adapty 提供的完整事件列表。
我们建议使用 Adapty 提供的默认事件名称,但你也可以根据需要修改事件名称。
Adapty 将通过服务器到服务器集成向 AppsFlyer 发送订阅事件,让你可以在 AppsFlyer 看板中查看所有订阅事件,并将其与获客活动关联起来。
将您的应用连接到 AppsFlyer
完成上述步骤后,调用 updateAttribution 方法保存归因数据,并使用 Adapty.setIntegrationIdentifier() 设置集成标识符。
请先初始化 AppsFlyer SDK 并等待其 UID 回调,再在 Adapty 中执行用户识别。否则 appsflyer_id 会落在 Adapty 激活时创建的临时匿名用户画像上,无法始终同步到已识别的用户画像。一旦出现这种情况,AppsFlyer 的收入转发将静默失败。
事件结构
Adapty 通过 POST 请求将所选事件以 JSON 格式发送至 AppsFlyer:
- API v2:
https://api2.appsflyer.com/inappevent/{app_id} - API v3:
https://api3.appsflyer.com/inappevent/{app_id}(推荐)
每个事件的结构如下:
{
"appsflyer_id": "1699887556000-6192770",
"eventName": "subscription_renewed",
"eventTime": "2024-03-01 12:00:00",
"eventValue": "{\"af_content_id\":\"yearly.premium.6999\",\"af_order_id\":\"GPA.3383-4699-1373-07113\",\"store_country\":\"US\",\"profile_country\":\"US\",\"af_content_type\":\"in_app\",\"af_revenue\":\"9.9900\",\"af_currency\":\"USD\",\"af_quantity\":\"1\"}",
"os": "17.0.1",
"bundleIdentifier": "com.example.app",
"customer_user_id": "user_12345",
"eventCurrency": "USD",
"ip": "192.168.100.1",
"advertising_id": "00000000-0000-0000-0000-000000000000",
"idfa": "00000000-0000-0000-0000-000000000000",
"idfv": "00000000-0000-0000-0000-000000000000",
"att": "3"
}
其中:
| 参数 | 类型 | 描述 |
|---|---|---|
appsflyer_id | String | AppsFlyer ID(通过 SDK 采集)。 |
eventName | String | AppsFlyer 事件名称(由 Adapty 事件映射而来)。 |
eventTime | String | 事件的日期和时间(UTC,格式为 YYYY-MM-DD HH:MM:SS)。 |
eventValue | String | 包含事件详情的 JSON 字符串(见下文)。 |
os | String | 操作系统版本。 |
bundleIdentifier | String | 应用的 Bundle ID / 包名。 |
customer_user_id | String | 用户的 Customer User ID。 |
eventCurrency | String | 货币代码(例如”USD”)。 |
ip | String | 用户的 IP 地址。 |
advertising_id | String | 仅限 Android。Google 广告 ID。 |
idfa | String | 仅限 iOS。广告商标识符(ID for Advertisers)。 |
idfv | String | 仅限 iOS。供应商标识符(ID for Vendors)。 |
att | String | 仅限 iOS。App Tracking Transparency 状态(例如”3”表示已授权)。 |
eventValue 参数是一个 JSON 编码的字符串,包含以下字段: | ||
| 参数 | 类型 | 描述 |
| :------------------ | :------- | :---------------------------------------------- |
af_content_id | String | 应用商店中的产品 ID。 |
af_order_id | String | 原始交易 ID。 |
store_country | String | 商店用户的国家代码。 |
profile_country | String | 根据用户 IP 确定的国家代码。 |
af_content_type | String | 有收入时固定为 in_app。 |
af_revenue | String | 收入金额,保留 4 位小数。 |
af_currency | String | 货币代码。 |
af_quantity | String | 有收入时固定为 1。 |
问题排查
收益数据不一致
如果 Adapty 和 AppsFlyer 之间的收益数据存在差异,通常是因为并非所有用户都在使用包含 Adapty SDK 的应用版本。为确保数据一致性,你可以强制用户更新到包含 Adapty SDK 的版本。
集成数据缺失
如果事件发送失败,通常是由于集成数据缺失。请检查以下事项:
- 你的应用已安装 AppsFlyer SDK。
- 你正在调用
getAppsFlyerUID方法。
身份验证失败
如果控制台出现 Failed to authenticate 错误,可能是 AppsFlyer 版本与凭据版本不匹配导致的。