To set up AppsFlyer in an Expo app, you install react-native-appsflyer in a development build (it doesn’t run in Expo Go), add its config plugin to app.json, and start the SDK from your code. Since version 7 of the plugin, released in August 2026, that last step works differently: initSdk() is gone, and you now call init(), register your listeners, and call start() yourself once the SDK says it’s ready.
That change matters because most tutorials, AI coding tools and even AppsFlyer’s own developer hub pages still show the old initSdk() code. Paste it into a fresh Expo project and it fails, or worse, half works. This guide covers the full v7 setup for Expo, iOS tracking permission (ATT), SKAdNetwork, sending subscription revenue through RevenueCat, and how to check it all works before you spend money on ads.
What changed in react-native-appsflyer v7?
Short answer: Version 7.0 rewrote the plugin as a New Architecture-only module. It needs React Native 0.76 or later with the New Architecture on, which on Expo means SDK 52 or later. Every method now takes a single object, initSdk() is replaced by init() plus an explicit start(), and the old listener functions are replaced by register...Listener() calls.
The details are in AppsFlyer’s migration guide and changelog. The ones you’ll hit first:
| 6.x | 7.x |
|---|---|
initSdk({ devKey, appId, isDebug, ... }) |
init({ devKey, appId }), then start() |
isDebug: true |
enableDebug({ enabled: true }) |
onInstallConversionData(cb) |
registerConversionListener({ onConversionDataSuccess, onConversionDataFail }) |
onDeepLink(cb) |
registerDeepLinkListener({ onDeepLinking }), called before init() |
timeToWaitForATTUserAuthorization: 10 |
Removed. Ask for ATT yourself before init() |
logEvent(name, values, success, error) |
logEvent({ eventName, eventValues }), returns a Promise |
getAppsFlyerUID((err, uid) => ...) |
await getAppsFlyerUID() |
is_first_launch: "true" (a string) |
is_first_launch: true (a real boolean) |
Two smaller changes catch people out. A logEvent() promise now resolves when the event is queued, not when AppsFlyer’s server has received it. And callbacks you pass to the old signatures are silently ignored, so old code can run without errors and still do nothing.
The latest release, 7.0.4 (1 November 2026), added support for Expo SDK 58’s new AppDelegate and Android Gradle Plugin 9. If you’re on SDK 58, use 7.0.4 or later.
Should you upgrade, or stay on 6.x?
Stay on 6.x for now if your app hasn’t moved to the New Architecture, or if you send AppsFlyer data through Segment: Segment’s AppsFlyer plugin still calls the removed APIs. AppsFlyer says 6.x gets critical and security fixes for six months after the first 7.0 release, so plan the move for early 2027 at the latest.
For a new Expo app, start on 7.x. There’s no reason to build on the version that’s being retired.
Before you start: what you need
- An AppsFlyer account with your app added for each platform. From the dashboard you need the dev key and, for iOS, your App Store app ID (the number in your App Store URL, without the
id). - An Expo development build. Native SDKs like AppsFlyer don’t run in Expo Go. You’ll build with EAS or locally with
npx expo run:ios. - Expo SDK 52 or later, with the New Architecture on (the default from SDK 52).
- RevenueCat, if you sell subscriptions and want revenue in AppsFlyer. Optional, but covered below.
How to install AppsFlyer in an Expo app
Step 1: Install the packages
npx expo install expo-dev-client react-native-appsflyer expo-tracking-transparency
expo-tracking-transparency is only needed for the iOS ATT prompt, but almost every app running paid ads on iOS wants it.
Step 2: Add the config plugins to app.json
{
"expo": {
"plugins": [
[
"react-native-appsflyer",
{
"shouldUseStrictMode": false,
"shouldUsePurchaseConnector": false,
"preferAppsFlyerBackupRules": false
}
],
[
"expo-tracking-transparency",
{
"userTrackingPermission": "We use this to measure which ads bring people to the app."
}
]
],
"ios": {
"infoPlist": {
"NSAdvertisingAttributionReportEndpoint": "https://appsflyer-skadnetwork.com/"
}
}
}
}
What each part does:
shouldUseStrictMode: turn on only for kids’ apps. It switches to AppsFlyer’s strict SDK build for apps aimed at children.shouldUsePurchaseConnector: AppsFlyer’s own purchase tracking. Leave it off if RevenueCat sends your revenue (more on that below), or you’ll count every sale twice.preferAppsFlyerBackupRules: set totrueif your Android build fails ondataExtractionRules(see troubleshooting).NSAdvertisingAttributionReportEndpoint: sends a copy of Apple’s SKAdNetwork postbacks to AppsFlyer. The Expo install guide points out that the plugin doesn’t set this for you. If you run iOS ads, add it.userTrackingPermission: the text in the ATT prompt. Write it in plain words that say what the user gets or why you ask.
Step 3: Rebuild and check the iOS AppDelegate
Config plugins only run when the native projects are generated, so rebuild:
npx expo prebuild --clean
The AppsFlyer plugin adds three calls to your iOS AppDelegate so deep links and attribution reach the SDK. It only works if your AppDelegate still matches Expo’s template, and if it can’t add them it prints a warning during prebuild that’s easy to miss. Check:
grep -n "AppsFlyerAttribution" ios/*/AppDelegate.swift
You should see three lines. If you see fewer, add the missing calls by hand as shown in AppsFlyer’s guide. Use --clean every time: AppsFlyer’s issue tracker lists duplicate Android manifest entries as a known problem when prebuild runs over an existing android folder.
Step 4: Start the SDK with the v7 flow
Put the start-up code in one file and call it once, from your root layout. The order matters, and it’s the part most copied code gets wrong.
// lib/appsflyer.ts
import { Platform } from "react-native";
import AppsFlyer from "react-native-appsflyer";
import { requestTrackingPermissionsAsync } from "expo-tracking-transparency";
const DEV_KEY = process.env.EXPO_PUBLIC_APPSFLYER_DEV_KEY!;
const IOS_APP_ID = process.env.EXPO_PUBLIC_APPSFLYER_IOS_APP_ID!; // digits only
let started = false;
export async function startAppsFlyer(onReady?: () => void) {
if (started) return;
started = true;
// 1. iOS: ask for tracking permission BEFORE init(). v7 no longer waits for it.
if (Platform.OS === "ios") {
await requestTrackingPermissionsAsync();
}
// 2. Deep link listener goes before init(), on both platforms.
AppsFlyer.registerDeepLinkListener({
onDeepLinking: (result) => {
// Route the user, e.g. to result.data?.deep_link_value
console.log("AppsFlyer deep link", result);
},
});
// 3. init(): don't await it before registering the other listeners.
AppsFlyer.init({
devKey: DEV_KEY,
...(Platform.OS === "ios" ? { appId: IOS_APP_ID } : {}),
}).catch((err) => console.warn("AppsFlyer init failed", err));
if (__DEV__) {
AppsFlyer.enableDebug({ enabled: true });
}
// 4. Other listeners: synchronously, right after init(), never inside init().then().
AppsFlyer.registerConversionListener({
onConversionDataSuccess: (data) => {
if (data.is_first_launch && data.af_status === "Non-organic") {
console.log("Install from", data.media_source, data.campaign);
}
},
onConversionDataFail: (error) => console.warn("Conversion data failed", error),
});
// 5. start() only inside the session-ready callback. The SDK never starts itself.
AppsFlyer.registerSessionReadyListener(() => {
AppsFlyer.start()
.then(() => onReady?.())
.catch((err) => console.warn("AppsFlyer start failed", err));
});
}
The three rules behind that order come straight from AppsFlyer’s API reference:
registerDeepLinkListenerbeforeinit(). On Android, a deep link result that arrives before a listener exists is dropped for good, with no retry. That’s the classic “deferred deep links work on iOS but not Android” bug.- Other listeners right after
init(), not in its.then(). Registering late can miss the conversion data event. start()only insideregisterSessionReadyListener. Calling it straight afterinit()is the v7 version of “the SDK is installed but no installs show up”.
Where you call the ATT prompt is a product decision. Asking on the very first screen is simple, but some apps get a better opt-in rate by showing a short explainer first. Either way, it has to happen before init() if you want the IDFA on the install.
Then call it from your root layout:
// app/_layout.tsx
import { useEffect } from "react";
import { startAppsFlyer } from "@/lib/appsflyer";
export default function RootLayout() {
useEffect(() => {
startAppsFlyer();
}, []);
// ...
}
Step 5: Log the events your ads optimise for
Ad networks optimise for the events you send, so pick a few that mean real progress: sign-up finished, onboarding done, trial started. Use AppsFlyer’s predefined names (like af_complete_registration) where one fits, because they’re easier to map to each ad network’s standard events. In v7 you can import them as AFInAppEventType.
import AppsFlyer from "react-native-appsflyer";
await AppsFlyer.logEvent({
eventName: "af_complete_registration",
eventValues: { af_registration_method: "email" },
});
Event names are limited to 45 characters. And if you set your own user ID with setCustomerUserId({ customerId }), call it before start() if you want it on the install record.
How to send RevenueCat subscription revenue to AppsFlyer
If you sell subscriptions through RevenueCat, let RevenueCat send revenue to AppsFlyer from its servers instead of logging purchases in the app. It catches renewals and trial conversions that happen while the app is closed, and it reports refunds as negative revenue. That’s the revenue your ROAS numbers depend on.
RevenueCat only sends an event when the customer has an AppsFlyer ID attached. From the RevenueCat AppsFlyer docs, that’s the one required attribute. Set it once AppsFlyer has started and after Purchases.configure():
import AppsFlyer from "react-native-appsflyer";
import Purchases from "react-native-purchases";
import { startAppsFlyer } from "@/lib/appsflyer";
// Purchases.configure({ apiKey }) must already have run.
startAppsFlyer(async () => {
const appsFlyerId = await AppsFlyer.getAppsFlyerUID();
await Purchases.setAppsflyerID(appsFlyerId);
await Purchases.collectDeviceIdentifiers(); // IDFA/IDFV or GAID, plus IP
});
Because the ATT prompt runs before AppsFlyer starts, collectDeviceIdentifiers() picks up the IDFA when the user allowed tracking. If you ask for ATT later in your flow, call it again after they answer.
Then, in the RevenueCat dashboard:
- Open your project’s Integrations and add AppsFlyer.
- Paste your AppsFlyer dev key (one key for both platforms, or one each). If you use an S2S token instead, tick Key is a S2S token.
- Add a sandbox developer key too, or test purchases won’t reach AppsFlyer.
- Choose your event names and whether revenue is gross or after Apple’s and Google’s cut.
Three rules from RevenueCat’s docs that save a lot of confusion:
- Remove any purchase logging from the app. If both the app and RevenueCat send purchases, AppsFlyer counts them twice.
- Don’t write placeholder campaign values. RevenueCat’s attribution attributes (
$mediaSource,$campaignand so on) can only be set once per customer. Setting “Organic” while you wait for AppsFlyer locks it in. - AppsFlyer shows events by install date. A purchase today from someone who installed last week appears under last week. That alone explains a lot of “missing” events.
If you also sell through Stripe on the web, RevenueCat supports AppsFlyer’s Web Performance Measurement too, and notes that AppsFlyer plans to retire its older People-Based Attribution by the end of 2026.
What about SKAN and TikTok ads?
On iOS, users who decline tracking can only be measured through Apple’s SKAdNetwork, so the NSAdvertisingAttributionReportEndpoint key in step 2 is worth the one line. In AppsFlyer you then map your in-app events to SKAN conversion values, so Apple’s postbacks tell you more than “an install happened”.
If you’re running TikTok ads, AppsFlyer and TikTok can share SKAN postbacks and your conversion value mapping with each other. That’s set up in the two dashboards, with no app code. The catch is that the app has to send the events first, which is why steps 4 and 5 come before any ad spend.
How to test your AppsFlyer integration
Don’t judge the setup by the dashboard numbers on day one. Test it deliberately:
- Watch the debug logs. With
enableDebugon, run a development build and check the Xcode console oradb logcatfor the init, session-ready and start messages, then for each event you log. - Register a test device in AppsFlyer, using its IDFA or GAID.
- Run the SDK Integration Tests. In AppsFlyer, go to Settings → SDK Integration Tests, pick the app and your test device, delete the app from the device, and follow the wizard to check installs, events and deep links. A normal install from a test build shows up as organic. To test a non-organic install, use the wizard’s attribution link.
- Make a sandbox purchase with a new user, then open that customer in RevenueCat. Check the AppsFlyer ID attribute is there and the AppsFlyer event shows as delivered.
Troubleshooting: common AppsFlyer Expo errors
| What you see | Likely cause | Fix |
|---|---|---|
initSdk is not a function, or TypeScript errors on every AppsFlyer call |
6.x code on the 7.x plugin | Move to init() + start() as above, or pin react-native-appsflyer@6 |
| Native module is null, or nothing happens at all | Running in Expo Go, or an old build | Use a development build and rebuild after adding the plugin |
Android build fails on dataExtractionRules or fullBackupContent |
Another plugin (often expo-secure-store) sets backup rules |
Set preferAppsFlyerBackupRules: true and list react-native-appsflyer before that plugin |
| App runs, no installs in AppsFlyer | start() never called, or called outside the session-ready listener |
Call start() inside registerSessionReadyListener |
| Deferred deep links fail on Android | Deep link listener registered after init() |
Register it before init() |
| iOS deep links never fire | AppDelegate calls missing after prebuild |
Run the grep check from step 3 |
| No IDFA on iOS installs | ATT asked after init(), or not at all |
Ask for ATT before init() |
logEvent fails with “no devKey” |
Event logged before the SDK started | Log events only after start() |
| RevenueCat events never reach AppsFlyer | No $appsflyerId on the customer, or no sandbox key for test purchases |
Set the ID after configure, add the sandbox key |
| Revenue looks doubled | Purchases logged in the app and by RevenueCat | Remove in-app purchase logging, keep Purchase Connector off |
| RevenueCat shows HTTP 403 from AppsFlyer | Your AppsFlyer plan doesn’t cover these events, or you’re over its limits | Check your plan with AppsFlyer |
AppsFlyer Expo setup checklist
- Development build on Expo SDK 52+, New Architecture on
-
react-native-appsflyer7.0.4+ (or 6.x on purpose, with a plan to move) - Config plugin in
app.json, prebuild run with--clean - Three
AppsFlyerAttributioncalls inAppDelegate -
NSAdvertisingAttributionReportEndpointset for SKAN - ATT prompt shown before
init(), with a clear message - Deep link listener before
init(),start()inside the session-ready listener - A few predefined events logged for the actions your ads optimise for
- RevenueCat: AppsFlyer ID set, integration on, sandbox key added
- No purchase logging in the app
- SDK Integration Tests passed on a registered test device
When to bring in a developer
If you’re adding AppsFlyer to a clean, up-to-date Expo app, the steps above are usually enough. It’s worth getting help when the app came out of an AI builder and you’re not sure what the native setup looks like, when you have to migrate 6.x code that’s spread around the app, when deep links have to work alongside RevenueCat, push notifications and other SDKs, or when you’re about to spend real money on TikTok or Meta and need to trust the numbers on day one. Broken attribution doesn’t crash anything. You just spend the budget without knowing what worked.
I can set up AppsFlyer, RevenueCat and deep links in your Expo or React Native app, including one first built with Rork or another AI tool, and test it end to end before you spend on ads. If that’s where you are, see how I fix and finish Rork apps, look at my services, or tell me about your app. If your subscriptions aren’t loading in App Review yet, start with Guideline 2.1(b): in-app purchases not loading.
FAQ
Does AppsFlyer work with Expo Go?
No. AppsFlyer is a native SDK, and Expo Go only includes the native modules that ship with it. Install expo-dev-client and use a development build. Everything else about the Expo workflow, including EAS Build and config plugins, works as normal.
Do I need the ATT prompt to use AppsFlyer on iOS?
Not to record installs. Without permission, AppsFlyer doesn’t get the IDFA, and paid iOS installs are measured mainly through SKAdNetwork. If you want the IDFA, Apple requires the App Tracking Transparency prompt first, and with plugin v7 you have to show it before calling init().
Should I log purchases with AppsFlyer or let RevenueCat send them?
If you use RevenueCat, let RevenueCat send them. It sends renewals, trial conversions and refunds from its servers, including ones that happen while the app is closed. Logging purchases in the app as well counts them twice.
Is the AppsFlyer dev key a secret?
The dev key ships inside your app, so treat it as public, like a Firebase or Supabase public key. API and S2S tokens are different. Keep them on a server or in tools like RevenueCat, and never put them in the app.
Why does AppsFlyer show my test installs as organic?
Because they are. A build installed from Xcode, TestFlight or a direct download didn’t come from an ad. To test attribution, register your device as a test device and use the non-organic install test in AppsFlyer’s SDK Integration Tests page.
Further reading
- Expo installation (AppsFlyer)
- Migration guide: 6.x to 7.0 (AppsFlyer)
- React Native API reference (AppsFlyer)
- Testing the SDK integration (AppsFlyer)
- AppsFlyer integration (RevenueCat)
- TrackingTransparency (Expo)