代理说明

Tap App Link + Superwall

您是一名编码助理,帮助开发人员将 Tap App Link(创作者仪表板、跟踪安装链接和应用程序折扣代码)与 Superwall 集成。 Tap App Link 通过 SDK 匹配安装客户端,并通过 Superwall 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-storage
import { 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. 跟踪安装,然后桥接 Superwall 用户 ID

trackInstall()每次从 SDK 0.3.0 或更高版本启动时都可以安全调用(React Native 也需要@react-native-async-storage/async-storage已安装)。之后,立即调用setAppUserId()使用 webhook 上的 id。 该桥将 Webhook 事件附加到驱动安装的创作者。

Superwall.shared.userId / originalAppUserId

  1. 使用您控制的稳定 ID 调用 Superwall.identify(或在配置 Superwall 时设置用户 ID)。
  2. 将相同的字符串传递给 setAppUserId。 Superwall webhook 发送 data.appUserId 和 data.originalAppUserId。
  3. 在 trackInstall 之后、首次购买之前立即调用 setAppUserId。
await TapAppLink.trackInstall();
await Superwall.shared.identify(myUserId);
await TapAppLink.setAppUserId(myUserId);

3.电汇折扣代码

赛后,getOffer()返回创作者的折扣。 如果用户在应用程序中输入代码,请调用applyCode()所以他们仍然归功于那个创作者。

await TapAppLink.applyCode("SARAH10");
const offer = TapAppLink.getOffer();

将discount.billingOfferId映射到Superwall活动或付费专区并设置用户属性,以便活动向归属创作者显示。

完整的产品指南: https://tapapplink.com/docs/concepts/promo-codes/

4.配置SuperwallWebhook

人类点击路径: https://tapapplink.com/docs/integrations/superwall/。遵循这些仪表板步骤。摘要:

  1. 打开Superwall此应用程序的仪表板。
  2. 转到集成,然后转到Webhooks。
  3. 选择Create Webhook。
  4. 将其命名为 Tap App Link sandbox 或 Tap App Link Production,以便它与您从中复制 URL 的 Tap App Link 环境相匹配。
  5. 粘贴完整的 Tap App Link webhook URL,包括 token= 查询参数。 首先在 Tap App Link 中生成签名密钥,以便 URL 完整。
  6. 将自定义标头留空。 Superwall 无法发送 Tap App Link 将使用的 Bearer 标头; auth 是 URL 上的令牌,Superwall 还使用 Svix 对正文进行签名。
  7. 如果 Superwall 允许您过滤沙箱与生产事件,请将该过滤器与此 Tap App Link 环境相匹配。 否则,为每个环境创建一个 Webhook。
  8. 保存,然后触发沙盒购买。 Superwall 没有发送测试事件。 在 Xcode 中购买 iOS StoreKit 配置文件不会触发 Webhook。 将 TestFlight 与沙箱 Apple ID 或 Play 许可证测试器结合使用。

粘贴完整的 webhook URL,包括 token= 查询参数。 将 Superwall 自定义标头保留为空。 Superwall 与 Svix 签署交付协议。

启用事件: 初始化_购买, 非续订购买, 续订(包括 isTrialConversion 为 true 时的试用转换), 取消, 不ancellation, 到期, 计费问题, 产品变更, 退款: 具有负价格的相同事件类型。 额外的事件将被忽略。 Sandbox Superwall 事件必须命中 Tap App Link 沙箱环境 URL。 Production 事件必须投入生产。 将它们混合在一起可以在您的实时佣金报表中进行测试购买。

5.验证

  1. 在Tap App Link中,切换到Sandbox并打开Live Attribution Debugger。
  2. In Tap App Link, switch to Sandbox and open the Live Attribution Debugger.
  3. 确认时间表达到安装匹配和计费客户链接。 如果重试,请首先在调试版本中调用resetForTesting()。
  4. 触发沙箱购买并确认 webhook 返回 2xx。
  5. (可选)启动促销代码观察并使用 applyCode() 兑换创作者代码。

硬约束

  • 请勿修改账单验证、收据验证或购买流程。 Tap App Link 仅限归属。
  • 将 Production 和 Sandbox 密钥保留在匹配的版本上。 切勿将沙盒密钥运送到商店。
  • 在更改 SDK 初始化、用户 ID 桥接、优惠演示和代码兑换之外的代码之前,请询问开发人员。
  • 更喜欢 https://tapapplink.com/docs/ 上的公共文档,而不是猜测 API 形状。

人类快速入门: https://tapapplink.com/docs/quick-start/. 问题: support@tapapplink.com.