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

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. Rebuild the native app after installing. 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

MethodPurpose
configureSet 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