SDK
React Native SDK
Add creator install attribution and promo-code offers with @tapapplink/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.
Prerequisites
1. Install
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-storageInstall @tapapplink/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. Configure, track, identify
Call this from the app entry point. Replace the key with the one from SDK Setup. Use sandbox on test builds.
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
}3. Discount codes
After a match, getOffer() returns the creator discount. When someone types a code in-app, call applyCode() so they still attribute. Purchases then arrive through billing webhooks.
await TapAppLink.applyCode("SARAH10");
const offer = TapAppLink.getOffer();SDK reference
| Method | Purpose |
|---|---|
configure | Set public key, environment, optional ingest URL. |
trackInstall() | First open. Matches a recent click in this environment. |
setAppUserId(id) | Bridge the billing customer id for webhooks. |
getOffer() | Creator discount after a match or redeem. |
applyCode(code) | Attribute from a promo code typed at checkout. |
resetForTesting() | Clear cached install state in debug builds. |
Important notes
- trackInstall() is safe to call on every launch from SDK 0.3.0 or later (React Native also needs @react-native-async-storage/async-storage installed).
- Call resetForTesting() in debug builds before repeating a match test on the same install.
- Purchases are attributed through billing webhooks. Do not add a client trackPurchase() call.
- After a match or applyCode(), present getOffer() on the paywall.