代理須知
Tap App Link + Superwall
您是一名編碼助理,幫助開發人員將 Tap App Link(創作者儀表板、追蹤安裝連結和應用程式折扣代碼)與 Superwall 整合。 Tap App Link 透過 SDK 匹配安裝客戶端,並透過 Superwall Webhook 在伺服器端分配購買收入。 當觀看者在結帳時輸入代碼時,促銷代碼是第二個歸因路徑。
1.安裝並配置Tap App Link SDK
如果專案缺少 SDK,請為目標平台新增它,然後在啟動時呼叫一次配置。 在測試建置中使用沙箱密鑰和環境,在商店建置中使用生產環境。
- React Native / Expo (development client; Expo Go cannot load Play Install Referrer): install @Tap App Link/react-native@^0.3.3 and the optional peer @react-native-async-storage/async-storage (yarn add, npm install, or npx expo install). Without AsyncStorage, each cold launch posts again.
- iOS: Swift Package https://github.com/tapapplink/tapapplink-ios from "0.3.3"
- Android: implementation("com.github.Tap App Link:Tap App Link-android:0.3.3")
- Flutter: Tap App Link: ^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. 追蹤安裝,然後橋接 Superwall 用戶 ID
trackInstall()每次從 SDK 0.3.0 或更高版本啟動時都可以安全地呼叫(React Native 也需要@react-native-async-storage/async-storage安裝)。 之後立即致電setAppUserId()使用 webhook 上的 id。 該橋將 Webhook 事件附加到驅動安裝的創作者。
Superwall.shared.userId / originalAppUserId
- 使用您控制的穩定 ID 呼叫 Superwall.identify(或在配置 Superwall 時設定使用者 ID)。
- 將相同的字串傳遞給 setAppUserId。 Superwall webhook 傳送 data.appUserId 和 data.originalAppUserId。
- 在 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. 配置 Superwall webhook
人類點擊路徑: https://tapapplink.com/docs/integrations/superwall/。 請依照這些儀表板步驟操作。 概括:
- 開啟此應用程式的 Superwall 儀表板。
- 轉到集成,然後轉到 Webhooks。
- 選擇建立 Webhook。
- 將其命名為 Tap App Link sandbox 或 Tap App Link Production,以便它與您從中複製 URL 的 Tap App Link 環境相符。
- 貼上完整的 Tap App Link webhook URL,包括 token= 查詢參數。 首先在 Tap App Link 中產生簽章金鑰,以便 URL 完整。
- 將自訂標頭留空。 Superwall 無法傳送 Tap App Link 將使用的 Bearer 標頭; auth 是 URL 上的令牌,Superwall 也使用 Svix 對正文進行簽署。
- 如果 Superwall 允許您過濾沙箱與生產事件,請將該過濾器與此 Tap App Link 環境相符。 否則,為每個環境建立一個 Webhook。
- 儲存,然後觸發沙盒購買。 Superwall 沒有發送測試事件。 在 Xcode 中購買 iOS StoreKit 設定檔不會觸發 Webhook。 將 TestFlight 與沙箱 Apple ID 或 Play 授權測試器結合使用。
貼上完整的 webhook URL,包括 token= 查詢參數。 將 Superwall 自訂標頭保留為空。 Superwall 與 Svix 簽署交付協議。
啟用事件: 初始購買, 非續訂購買, 續約(包括 isTrialConversion 為 true 時的試用轉換), 消除, 取消取消, 過期, 計費問題, 產品變更, 退款:相同的活動類型,但價格為負。 額外的事件將被忽略。 Sandbox Superwall 事件必須命中 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.