代理说明
Tap App Link + Adapty
您是一名编码助理,帮助开发人员将 Tap App Link(创作者仪表板、跟踪安装链接和应用程序折扣代码)与 Adapty 集成。 Tap App Link 通过 SDK 匹配安装客户端,并通过 Adapty webhook 属性购买收入服务器端。 当观看者在结账时输入代码时,促销代码是第二个归因路径。
1.安装和配置Tap App Link SDK
如果项目缺少 SDK,请为目标平台添加它,然后在启动时调用一次配置。 在测试构建中使用沙箱密钥和环境,在商店构建中使用生产环境。
- React Native / Expo(开发客户端;Expo Go 无法加载 Play Install Referrer):安装 @tapapplink/react-native@^0.3.3 和可选的同级 @react-native-async-storage/async-storage (yarn add、npm install 或 npx expo install)。 如果没有 AsyncStorage,每次冷启动都会再次发布。
- iOS:来自“0.3.3”的 Swift 包 https://github.com/tapapplink/tapapplink-ios
- Android:实现(“com.github.tapapplink:tapapplink-android:0.3.3”)
- Flutter: tapapplink: ^ 0.3.3
使用SDK每个平台上的0.3.3或更高版本。
yarn add @tapapplink/react-native@^0.3.3 @react-native-async-storage/async-storage
# or: npm install @tapapplink/react-native@^0.3.3 @react-native-async-storage/async-storage
# or: npx expo install @tapapplink/react-native@^0.3.3 @react-native-async-storage/async-storageimport { TapAppLink } from "@tapapplink/react-native";
import Purchases from "react-native-purchases";
TapAppLink.configure({
publicKey: "YOUR_TAPAPPLINK_KEY",
environment: __DEV__ ? "sandbox" : "production",
});
await TapAppLink.trackInstall();
await TapAppLink.setAppUserId(await Purchases.getAppUserID());
const offer = TapAppLink.getOffer();
if (offer?.billingOfferId) {
const offerings = await Purchases.getOfferings();
const discounted = offerings.all[offer.billingOfferId];
// Present this offering on the paywall
}2. 跟踪安装,然后桥接 Adapty 用户 ID
trackInstall()每次从 SDK 0.3.0 或更高版本启动时都可以安全调用(React Native 也需要@react-native-async-storage/async-storage已安装)。之后,立即调用setAppUserId()使用 webhook 上的 id。 该桥将 Webhook 事件附加到驱动安装的创作者。
Adapty customer_user_id
- 使用您控制的稳定的 customer_user_id(您的登录用户 ID)调用 Adapty.identify。
- 将相同的字符串传递给 setAppUserId。 Webhook 发送 customer_user_id。 如果 customer_user_id 为空,Tap App Link 也接受 profile_id。
- 在 trackInstall 之后、首次购买之前立即调用 setAppUserId。
await TapAppLink.trackInstall();
await adapty.identify(myUserId);
await TapAppLink.setAppUserId(myUserId);3.电汇折扣代码
赛后,getOffer()返回创作者的折扣。 如果用户在应用程序中输入代码,请调用applyCode()所以他们仍然归功于那个创作者。
await TapAppLink.applyCode("SARAH10");
const offer = TapAppLink.getOffer();将discount.billingOfferId映射到Adapty展示位置或付费专区ID,并在getOffer()或applyCode()之后显示该付费专区。
完整的产品指南: https://tapapplink.com/docs/concepts/promo-codes/
4.配置AdaptyWebhook
人类点击路径: https://tapapplink.com/docs/integrations/adapty/。遵循这些仪表板步骤。摘要:
- 打开集成,然后打开 Adapty 仪表板中的 Webhook。
- 打开集成。
- Adapty 使用一种具有单独的 Production 和 Sandbox 字段的形式。 从匹配的 Tap App Link 环境中填充每对。
- 对于 Tap App Link Production:将生产 Webhook URL 粘贴到 Production 端点 URL 中,并将生产授权值粘贴到生产端点的授权标头值中。
- 对于 Tap App Link Sandbox:将沙箱 Webhook URL 粘贴到 Sandbox 端点 URL 中,并将沙箱授权值粘贴到沙箱端点的授权标头值中。
- 完全按照复制的内容粘贴每个授权值,包括单词 Bearer。 Adapty不会为您添加Bearer。
- 在事件名称中,保留 Adapty 的默认事件 ID。 重命名它们意味着 Tap App Link 将忽略这些事件。
- 启用下面列表中的事件类型。 额外启用的事件将被忽略。
- 节省。 Adapty 立即将空 JSON 对象 {} POST 到 URL。 Tap App Link用JSON回复2xx,完成Adapty的验证。
将复制的值粘贴到匹配 Adapty 环境的授权标头值中。 包括“承载者”一词。 Adapty 将该字符串作为授权标头发送,不带额外前缀。
启用事件: 订阅开始 / 订阅_初始购买, 非订阅购买, 试用_转换, Subscription_r续订, 订阅更新取消 / 订阅取消, 订阅_过期, 订阅退款, 非订阅购买退款, 检测到计费问题。 额外的事件将被忽略。 Sandbox Adapty 事件必须命中 Tap App Link 沙箱环境 URL。 Production 事件必须投入生产。 将它们混合在一起可以在您的实时佣金报表中进行测试购买。
5.验证
- 在Tap App Link中,切换到Sandbox并打开Live Attribution Debugger。
- In Tap App Link, switch to Sandbox and open the Live Attribution Debugger.
- 确认时间表达到安装匹配和计费客户链接。 如果重试,请首先在调试版本中调用resetForTesting()。
- 触发沙箱购买并确认 webhook 返回 2xx。
- (可选)启动促销代码观察并使用 applyCode() 兑换创作者代码。
硬约束
- 请勿修改账单验证、收据验证或购买流程。 Tap App Link 仅限归属。
- 将 Production 和 Sandbox 密钥保留在匹配的版本上。 切勿将沙盒密钥运送到商店。
- 在更改 SDK 初始化、用户 ID 桥接、优惠演示和代码兑换之外的代码之前,请询问开发人员。
- 更喜欢 https://tapapplink.com/docs/ 上的公共文档,而不是猜测 API 形状。
人类快速入门: https://tapapplink.com/docs/quick-start/. 问题: support@tapapplink.com.