代理須知
Tap App Link + Adapty
您是一名編碼助理,幫助開發人員將 Tap App Link(創作者儀表板、追蹤安裝連結和應用程式折扣代碼)與 Adapty 整合。 Tap App Link 透過 SDK 匹配安裝客戶端,並透過 Adapty 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. 追蹤安裝,然後橋接 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. 配置 Adapty webhook
人類點擊路徑: 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 將此字串作為授權標頭發送,不含額外前綴。
啟用事件: 訂閱開始 / 訂閱_初始購買, 非訂閱購買, 試用_轉換, 訂閱更新, 訂閱更新取消 / 訂閱取消, 訂閱_過期, 訂閱退款, 非訂閱購買退款, 偵測到計費問題。 額外的事件將被忽略。 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.