
React Native Affiliate Tracking for Subscription Apps
React Native affiliate tracking has two exact routes and a third that is not there. A tracked link carries a claim token into your app, and a typed creator code needs no link setup at all. Both bind the device to one affiliate id, with no probability involved. The third route, the first-launch match our iOS, Android and Flutter SDKs ask the API for when an install arrives carrying nothing, is not implemented in @myappaffiliate/sdk-react-native 0.2.0. We re-read the source on 2026-11-10 to be sure.
That absence changes how you design a program, not whether you can run one. Below: how a link reaches the app cold and warm, what Expo changes, which id RevenueCat reports, and the field that closes the gap.
#What React Native affiliate tracking looks like on a subscription app
Three things happen in order: a referral reaches the device, the device gets bound to an affiliate, and your user id gets bound to the same record. The first step has three possible routes on mobile, and React Native gives you two.
| Route | How it arrives | Confidence | Available in RN 0.2.0 |
|---|---|---|---|
| Claim token | A tracked link opens the app with `claim_token` or `ct` in the query | Exact, one click to one device | Yes |
| Creator code | The user types `LUMI` into a field, or a link carries `via`, `ref`, `maa_code` or `code` | Exact, the code identifies the link | Yes |
| First-launch match | Nothing arrives, so the server compares a hashed IP against recent clicks | Probabilistic, refuses when ambiguous | No |
The confidence column is the part worth arguing about. A claim token is a row lookup: our API finds the click by its token, checks it belongs to the authenticated app, and writes the attribution. A code is nearly as good, because it names a link and the link names an affiliate. The third route is the only place in the system where we guess, and it is built to refuse rather than guess badly, as derived in how attribution windows work.
Our opinion, after shipping six SDKs: on React Native you should be designing for the first two routes anyway. The third is insurance, and insurance that pays out on a hashed IP is the weakest claim in any ledger. What changes here is that it is absent rather than weak, and an absent fallback gets replaced by product design.
#How a link reaches a React Native app, cold and warm
Two different mechanisms, and handling one while forgetting the other is the most common bug we see. A link that launches the app arrives through getInitialURL. A link that arrives while the app is already running fires a url event.
React Native's Linking reference, on version 0.88 as of 2026-11-10, documents both: getInitialURL() resolves to the launch URL or null, and addEventListener('url', handler) returns an EventSubscription.
Pass linking to start and the SDK wires both for you:
import AsyncStorage from "@react-native-async-storage/async-storage";
import { Linking } from "react-native";
import { myAppAffiliate } from "@myappaffiliate/sdk-react-native";
await myAppAffiliate.start({
apiKey: "pk_live_…",
storage: AsyncStorage,
linking: Linking,
});That subscribes to the url event first, then reads getInitialURL, keeping the subscription so a second start removes the previous listener instead of stacking one. Every URL goes to attribute(url), which returns false with no network call when the link carries no referral parameter, so you can hand it every deep link your app receives.
Two notes from React Native's own page, both checked on 2026-11-10, that have cost us debugging time. getInitialURL can resolve to null while Remote JS Debugging is attached, so a cold-start test under a debugger proves nothing. And on an app using SceneDelegate, connectionOptions has to be passed through at bootstrap or it resolves to null there too, because once Info.plist declares UIApplicationSceneManifest, RCTLinkingManager ignores the AppDelegate methods.
The store side, associated domains and digital asset links, is platform work rather than JS work. It lives in starting an affiliate program on an iOS app and running one on Android.
#What Expo changes, and what it leaves alone
Less than most teams expect. Our package imports neither react-native nor AsyncStorage, so one build runs in bare React Native, a development build and Expo Go. What changes is how links get configured and tested, never the SDK calls.
Expo's linking reference documents Expo SDK 58 as of 2026-11-10, and expo-linking still exports both calls the SDK needs: getInitialURL() and addEventListener(type, handler). The page now steers app code towards the useLinkingURL() hook, which does not change what you hand the SDK:
import * as Linking from "expo-linking";
await myAppAffiliate.start({ apiKey: "pk_live_…", storage: AsyncStorage, linking: Linking });AsyncStorage is the easy half. Expo's AsyncStorage page lists @react-native-async-storage/async-storage as included in Expo Go, installed with npx expo install, at a recommended version of 2.2.0 on 2026-11-10.
| Concern | Bare React Native | Expo development build | Expo Go |
|---|---|---|---|
| SDK calls | Identical | Identical | Identical |
| AsyncStorage | Install and link normally | `npx expo install`, included | Included in Expo Go |
| Linking module | `react-native` Linking | `expo-linking` or RN Linking | Either |
| Custom scheme | Native project config | `scheme` in app config, then a new build | Expo Go uses its own scheme |
| Universal links | Native entitlement | Entitlement plus a hosted association file | Not your app's native config |
| Creator codes | Works | Works | Works |
Two of those rows come from Expo's docs, read 2026-11-10. The deep linking guide says that after adding a custom scheme "you need to create a new development build", and that an app without one falls back to android.package and ios.bundleIdentifier. The iOS universal links page wants "associatedDomains": ["applinks:example.com"] under expo.ios, plus an apple-app-site-association file served over HTTPS from public/.well-known/ whose appID is <APPLE_TEAM_ID>.<BUNDLE_ID>. EAS registers that entitlement with Apple for you.
Expo Go is where expectations break, and Expo's custom native code page gives the reason: an Expo Go app reaches only native libraries shipped inside the Expo SDK, or ones that add no native code of their own. Associated domains and a verified asset links file are that kind of config, and they belong to your bundle identifier rather than Expo Go's. Test links on a development build. The code field keeps working while you wait on a provisioning profile.
#Why start wants storage and linking handed to it
Because the alternative is a package that will not install in half of its target environments. Those two objects are the only things the SDK cannot reach on its own, and injecting them is what keeps it free of native imports.
await myAppAffiliate.start({
apiKey: "pk_live_…",
storage: AsyncStorage,
linking: Linking,
debug: true,
});Both are typed structurally. AsyncStorageLike wants getItem, setItem and an optional removeItem. LinkingLike wants getInitialURL and addEventListener, whose return type is declared unknown because React Native, expo-linking and older versions each hand back something different. The SDK narrows that value before it calls remove. The payoff is not the typing: all 22 unit tests run on plain Node, because nothing here needs a device.
Omitting storage does not break the SDK, which is worth knowing rather than discovering. It falls back to an in-memory map and prints a warning. Attribution then survives until the process dies, which on a phone means it does not survive. Five keys are persisted, all recognisable in a storage dump: maa_device_id, maa_pending_token, maa_pending_code, maa_affiliate_id and maa_attribution_id.
You never pass an API host. The production URL is compiled in, and apiBaseUrl exists only for staging or a self-hosted deployment. Every call resolves to false or null on failure instead of throwing, because an attribution SDK has no business being load-bearing in a render path. That rule and this call shape are shared across all six packages: see one attribution engine for mobile and web.
#The id RevenueCat reports is the only join key that matters
One string decides whether any of this turns into a commission. identify(userId) has to receive the same value your biller reports back to us. For RevenueCat that is the app user id, and getting it wrong produces two healthy looking halves that never meet.
import Purchases from "react-native-purchases";
const { customerInfo, created } = await Purchases.logIn(user.id);
await myAppAffiliate.identify(user.id);That destructuring is RevenueCat's own, from the identifying customers guide read on 2026-11-10. The same page sets the constraints: ids unique per user, not guessable, a ceiling of 100 characters, and neither email addresses nor advertising identifiers. Values such as anonymous, guest, unknown and 0 are blocked, as is any id containing a slash. RevenueCat's configuration guide adds that Purchases is configured once early in the app lifecycle, and that passing null gets you a generated anonymous id.
Anonymous ids are the trap. If a purchase happens before your logIn call it lands on an anonymous id, and the webhook arrives carrying that id rather than yours. RevenueCat's webhook field reference, checked the same day, describes app_user_id as the last app user id seen for a subscriber and original_app_user_id as the first, and tells you to search both plus the aliases array. So call identify as soon as you have a user id, before the paywall. Which event types move a balance is covered in RevenueCat webhooks and affiliate commissions.
There is no subscriber attribute to set, no affiliate_id to write into RevenueCat, and no third SDK call. The full argument for joining on the user id is in the RevenueCat attribution setup.
#What happens to a React Native install that arrives with no link
Nothing is attributed, and no request is sent. Here is the mechanism rather than a caveat. On every start, the SDK persists a device id, then checks whether a previous launch captured a referral it failed to deliver. If there is no stored affiliate id, no pending token and no pending code, it returns.
Our API does support a third path on the same endpoint. A bare install request, carrying only a device id and a first-open timestamp, makes the server compare a hashed IP against recent clicks for that app inside a window (deferredWindowMinutes, 60 by default). It attributes a single match, answers 409 when two affiliates are plausible, and 404 when nothing matches. The attribution row stores matchMethod as deferred_ip, so a guess is never filed as a click. Our iOS, Android and Flutter SDKs make that request once per install, with a retry budget so an offline first launch does not spend the attempt.
The React Native package never makes it. There is no public call that sends a bare install, no maa.deferredTried key in its storage set, and no test among its 22 that mentions a deferred match. Our attribution plan carries this as an open gap, re-verified in packages/sdk-react-native/src on 2026-11-10. We are not putting a date on it here, because we have not committed to one.
| SDK | Claim token link | Typed code | Bare first-launch request |
|---|---|---|---|
| iOS | Yes | Yes | Yes, once per install |
| Android | Yes | Yes | Yes, plus the Play install referrer |
| Flutter | Yes | Yes | Yes, once per install |
| React Native 0.2.0 | Yes | Yes | No |
Who this costs. On Android the gap matters least, because the Play Store can carry a referrer through the install, as derived in the Install Referrer post. On iOS it matters most: the App Store drops the claim token on a cold install, so a user who tapped a creator's link, installed, and opened the app with no further context has no exact route left. On Flutter a hashed IP might still recover them. On React Native it will not.
Put arithmetic on it. Take 100 installs from one creator in a month: 60 open through a tracked link, 25 type the code, 15 arrive carrying neither. Those 15 are unattributed on React Native. If 30% of the cohort subscribes at $9.99 a month on a 20% deal, each attributed subscriber banks 200 cents a month, because 999 cents at 2,000 basis points rounds to 200. The 15 lost installs are 4 or 5 subscribers, so roughly $9 of monthly recurring commission a creator never sees. Small in isolation, compounding and invisible. We have not measured that split on a production React Native app, so treat 60, 25 and 15 as arithmetic rather than a benchmark.
#Close the no-link install with a code field, in five steps
A creator code is the one route that works everywhere: no scheme, no entitlement, no store cooperation, and no probability. On React Native it is doing double duty, because it is also the replacement for the fallback you do not have.
- Add a "Got a code?" field to onboarding, after the first value screen and before the paywall. Not in settings, where nobody looks.
- Call
await myAppAffiliate.applyCode(code)on submit and read the boolean.falsemeans the code was wrong or the network was down. - Keep the field forgiving: uppercase and trim the input, and let a user who installed yesterday still enter one. A failed request is persisted and retried on the next
start. - Give creators the code beside their link in their dashboard, and make the on-ramp script say it out loud. A code nobody speaks is a field nobody fills.
- Read
attributedAffiliateId()after onboarding and skip the field for anyone a link already attributed.
const ok = await myAppAffiliate.applyCode(input.trim().toUpperCase());
if (!ok) setError("That code did not match. Check it with the creator.");What it costs is honesty about a funnel step. Every code field is friction, and we would not argue for one as the primary route on a platform where the fallback works. Here it is the floor under the other two, and for an audience arriving through a podcast it is the only route, which is the case made in launching a first affiliate program.
#Where MyAppAffiliate fits, gap included
Our React Native SDK is two calls and no API host: start once at launch, identify when you know the user. The public reference lists the whole surface: start, identify, attribute, applyCode, attributedAffiliateId and reset. Pure TypeScript, no native module to link, works in Expo Go, MIT licensed on npm.
It is also the one mobile SDK of ours with no first-launch deferred match, which we would rather you read here than discover in a dashboard. The Flutter package does have it, documented in Flutter affiliate tracking with RevenueCat, and the integration is otherwise shaped the same. We charge a flat monthly fee rather than a percentage of tracked revenue, so a recovered install is worth exactly what it sounds like to you.
#Verify it in this order, before you trust a single commission
Do these in sequence on a development build, with debug: true so the SDK logs what it decided.
- Open a tracked link while the app is backgrounded and confirm the
urlpath attributes. Watch forattributed to aff_…in the console. - Force quit, open the same link cold, and confirm
getInitialURLattributes. Detach Remote JS Debugging first, since it can make that call resolve tonull. - Delete the app, reinstall, open it with no link, then type a code and confirm
applyCodereturnstrue. This is the no-link install, and the code is what rescues it. - Call
identifywith the exact string you pass toPurchases.logIn, buy in sandbox, and confirmINITIAL_PURCHASEcarries that value inapp_user_id. - Check the dashboard funnel moves through clicks, installs, identified and paid for that one device. A stall between installs and identified is almost always two different id strings.
Run step 3 before you write the creator onboarding script. It tells you how much of your program rests on a field a human has to fill, and on React Native that share is the largest of anything we ship.
Does the MyAppAffiliate React Native SDK support deferred deep linking?
No. Version 0.2.0 posts to the install endpoint only when a claim token or a creator code is in hand. The probabilistic first-launch match that our iOS, Android and Flutter SDKs ask for is not wired up in the React Native package. Verified in the source on 2026-11-10.
Do affiliate links work in Expo Go?
Creator codes do, with no link setup at all. Custom schemes and universal links do not behave like your shipped app in Expo Go, because its native code is fixed. Expo's guidance is that Expo Go only carries native libraries in the Expo SDK or libraries with no custom native code.
Which id should `identify()` receive in a RevenueCat app?
The same string you pass to `Purchases.logIn`, because that is what RevenueCat sends back as `app_user_id` on every webhook. RevenueCat documents a 100 character limit, warns against email addresses and advertising identifiers, and blocks values like `anonymous` and `guest`.
What happens if a React Native install arrives with no link and no code?
Nothing is attributed. The SDK generates a device id, retries an undelivered payload from an earlier launch, and returns. It sends no bare install request, so the server never gets the chance to run an IP and time window match for that device.
Can I call the install endpoint myself to get the deferred match?
We would not build on that today. The endpoint runs the match when a request carries neither a token nor a code, but our public API reference documents only the token and code shapes, and the 409 ambiguous response is not in it. Closing the gap in the SDK is our job, not yours.