SDK
React Native SDK
Add creator install attribution and promo-code offers with @Tap App Link/react-native. The same package works in Expo development clients and production builds, and in bare React Native. Use a development build; Expo Go cannot load Play Install Referrer.
先決條件
1. 安裝
Install @Tap App Link/react-native@^0.3.3 and the optional peer @react-native-async-storage/async-storage. Without AsyncStorage, each cold launch posts install again. Rebuild the native app. Bare iOS apps should run cd ios && pod install after installing. The Android package includes a small Play Install Referrer module. A JS-only reload does not include that native module.
2. 配置、追蹤、識別
從應用程式入口點調用它。 將密鑰替換為 SDK 設定中的密鑰。 在測試版本上使用 sandbox。
3. 折扣碼
比賽結束後,getOffer() 返回創作者折扣。 當有人在應用程式內輸入代碼時,請呼叫 applyCode(),以便他們仍然進行歸因。 然後購買透過計費 webhook 到達。
SDK 參考
| 方法 | 目的 |
|---|---|
配置 | 設定公鑰、環境、可選的攝取 URL。 |
trackInstall() | 首次開啟。 匹配此環境中的最近一次點擊。 |
設定應用程式用戶ID(id) | 橋接 webhook 的計費客戶 ID。 |
getOffer() | 比賽或兌換後創作者折扣。 |
applyCode(code) | 結帳時輸入的促銷代碼的屬性。 |
resetForTesting() | 清除調試版本中快取的安裝狀態。 |
重要說明
- trackInstall() 在 SDK 0.3.0 或更高版本的每次啟動時都可以安全地呼叫(React Native 還需要安裝 @react-native-async-storage/async-storage)。
- 在同一安裝上重複匹配測試之前,在偵錯版本中呼叫resetForTesting()。
- 購買是透過計費 webhook 進行的。 不要新增客戶端 trackPurchase() 呼叫。
- 配對或 applyCode() 後,在付費牆上出示 getOffer()。