Agent instructions
Tap App Link + Superwall
You are a coding assistant helping a developer integrate Tap App Link (creator dashboards, tracked install links, and discount codes for apps) with Superwall. Tap App Link matches installs client-side via an SDK and attributes purchase revenue server-side via a Superwall 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):
yarn add @tapapplink/react-native - iOS: Swift Package
https://github.com/tapapplink/tapapplink-ios - Android:
implementation("com.github.tapapplink:tapapplink-android:0.1.1") - Flutter:
tapapplink: ^0.1.2
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
}2. Track the install, then bridge the Superwall user id
Call trackInstall() on every launch. It only records once per install. Immediately after, call setAppUserId() with Superwall.shared.userId / originalAppUserId. That bridge attaches webhook events to the creator who drove the install.
- Call Superwall.identify (or set the user id when you configure Superwall) with a stable id you control.
- Pass that same string to setAppUserId. Superwall webhooks send data.appUserId and data.originalAppUserId.
- Call setAppUserId immediately after trackInstall, before the first purchase.
await TapAppLink.trackInstall();
await Superwall.shared.identify(myUserId);
await TapAppLink.setAppUserId(myUserId);3. Wire creator 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 a Superwall campaign or paywall and set user attributes so that campaign shows for the attributed creator.
Full product guide: https://tapapplink.com/docs/concepts/promo-codes/
4. Configure the Superwall webhook
Human click path: https://tapapplink.com/docs/integrations/superwall/. Follow those dashboard steps. Summary:
- Open the Superwall dashboard for this app.
- Go to Integrations, then Webhooks.
- Choose Create Webhook.
- Name it Tap App Link sandbox or Tap App Link production so it matches the Tap App Link environment you copied the URL from.
- Paste the full Tap App Link webhook URL, including the token= query param. Generate the signing secret in Tap App Link first so the URL is complete.
- Leave custom headers empty. Superwall cannot send a Bearer header that Tap App Link would use; auth is the token on the URL, and Superwall also signs the body with Svix.
- If Superwall lets you filter sandbox vs production events, match that filter to this Tap App Link environment. Otherwise create one webhook per environment.
- Save, then trigger a sandbox purchase. Superwall has no Send test event. iOS StoreKit Configuration file purchases in Xcode do not fire webhooks. Use TestFlight with a sandbox Apple ID, or a Play license tester.
Paste the full webhook URL, including the token= query param. Leave Superwall custom headers empty. Superwall signs deliveries with Svix.
Enable events: initial_purchase, non_renewing_purchase, renewal (including trial conversions when isTrialConversion is true), cancellation, uncancellation, expiration, billing_issue, product_change, refunds: same event types with a negative price. Extra events are ignored. Sandbox Superwall events must hit the Tap App Link sandbox environment URL. Production events must hit production. Mixing them puts test events into live payouts.
5. Verify
- In Tap App Link, switch to Sandbox and open the Live Attribution Debugger.
- Start a link session, scan the QR, then launch the test build with the sandbox SDK key.
- 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.