Agent instructions
Tap App Link + Adapty
You are a coding assistant helping a developer integrate Tap App Link (creator dashboards, tracked install links, and discount codes for apps) with Adapty. Tap App Link matches installs client-side via an SDK and attributes purchase revenue server-side via a Adapty webhook. Promo codes are a second attribution path when the viewer types a code at checkout.
1. Install and configure the Tap App Link SDK
If the project is missing the SDK, add it for the target platform, then call configure once on launch. Use the sandbox key and environment on test builds, production on store builds.
- React Native / Expo (development client; Expo Go cannot load Play Install Referrer): install @tapapplink/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.tapapplink:tapapplink-android:0.3.3")
- Flutter: tapapplink: ^0.3.3
Use SDK 0.3.3 or later on every platform.
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. Track the install, then bridge the Adapty user id
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). Immediately after, call setAppUserId() with the id on the webhook. That bridge attaches webhook events to the creator who drove the install.
Adapty customer_user_id
- Call Adapty.identify with a stable customer_user_id you control (your logged-in user id).
- Pass that same string to setAppUserId. Webhooks send customer_user_id. Tap App Link also accepts profile_id if customer_user_id is empty.
- Call setAppUserId immediately after trackInstall, before the first purchase.
await TapAppLink.trackInstall();
await adapty.identify(myUserId);
await TapAppLink.setAppUserId(myUserId);3. Wire discount codes
After a match, getOffer() returns the creator's discount. If the user types a code in-app, call applyCode() so they still attribute to that creator.
await TapAppLink.applyCode("SARAH10");
const offer = TapAppLink.getOffer();Map discount.billingOfferId to an Adapty placement or paywall id and present that paywall after getOffer() or applyCode().
Full product guide: https://tapapplink.com/docs/concepts/promo-codes/
4. Configure the Adapty webhook
Human click path: https://tapapplink.com/docs/integrations/adapty/. Follow those dashboard steps. Summary:
- Open Integrations, then Webhook in the Adapty dashboard.
- Turn the integration on.
- Adapty uses one form with separate Production and Sandbox fields. Fill each pair from the matching Tap App Link environment.
- For Tap App Link Production: paste the production webhook URL into Production endpoint URL, and the production Authorization value into Authorization header value for production endpoint.
- For Tap App Link Sandbox: paste the sandbox webhook URL into Sandbox endpoint URL, and the sandbox Authorization value into Authorization header value for sandbox endpoint.
- Paste each Authorization value exactly as copied, including the word Bearer. Adapty does not add Bearer for you.
- In Events names, leave Adapty's default event ids. Renaming them means Tap App Link will ignore those events.
- Enable the event types in the list below. Extra enabled events are ignored.
- Save. Adapty immediately POSTs an empty JSON object {} to the URL. Tap App Link replies 2xx with JSON, which completes Adapty's verification.
Paste the copied value into Authorization header value for the matching Adapty environment. Include the word Bearer. Adapty sends that string as the Authorization header with no extra prefix.
Enable events: subscription_started / subscription_initial_purchase, non_subscription_purchase, trial_converted, subscription_renewed, subscription_renewal_cancelled / subscription_cancelled, subscription_expired, subscription_refunded, non_subscription_purchase_refunded, billing_issue_detected. Extra events are ignored. Sandbox Adapty events must hit the Tap App Link sandbox environment URL. Production events must hit production. Mixing them puts test purchases on your live commission statements.
5. Verify
- In Tap App Link, switch to Sandbox and open the Live Attribution Debugger.
- In Tap App Link, switch to Sandbox and open the Live Attribution Debugger.
- Confirm the timeline reaches install matched and billing customer linked. If you retry, call resetForTesting() in debug builds first.
- Trigger a sandbox purchase and confirm the webhook returns 2xx.
- Optionally start a promo-code watch and redeem a creator code with applyCode().
Hard constraints
- Do not modify billing validation, receipt verification, or the purchase flow. Tap App Link is attribution-only.
- Keep Production and Sandbox keys on the matching builds. Never ship a sandbox key to the store.
- Ask the developer before changing code outside SDK initialization, user-id bridging, offer presentation, and code redemption.
- Prefer the public docs at https://tapapplink.com/docs/ over guessing API shapes.
Human quick start: https://tapapplink.com/docs/quick-start/. Questions: support@tapapplink.com.