🚀 AppsFlyer in React Native: The Complete Developer Guide (Deep Linking & Production Tips)
“Marketing: We got 50,000 installs!”
Developer: Awesome! From where?
Marketing: That’s… why we’re asking you.
😶
If you’ve ever integrated analytics into a React Native app, you’ve probably heard of AppsFlyer. If not, don’t worry. By the end of this article, you’ll understand not only how to integrate AppsFlyer but also why almost every company spending money on ads uses it.
We’ll build a mental model first (because copying code without understanding is how bugs are born), then we’ll integrate AppsFlyer step by step.
And I’m gonna convert most of my text content into images so will add more images in this article, because it’s AI era 😅
🤔 What is AppsFlyer?
Imagine you’re opening a new pizza shop and People keep coming in, Some say they saw your Instagram ad, Some came because of YouTube, Others found you through Google, A few just smelled pizza while walking by.
Now imagine 10 million customers.
Can you remember who came from where? Absolutely not.
That’s exactly what AppsFlyer does.
It keeps track of where every app install came from.
A Simple Analogy
🤷 Why Do We Need Mobile Attribution?
⚙️ How AppsFlyer Works
🎯 Attribution Models
AppsFlyer supports multiple attribution models.
🛠 Installing AppsFlyer
Install the SDK:
yarn add react-native-appsflyerInstall iOS pods:
cd ios
pod installDone?
Not yet.
Every React Native developer says:
“yarn add completed.”
Native Android:
“Hello?”
Native iOS:
“Don’t forget about us.”😂
🤖 Android Setup
Inside android/app/build.gradle
dependencies {
implementation 'com.appsflyer:af-android-sdk:6.+'
}Add your AppsFlyer Dev Key.
Update the Android Manifest if required by the SDK version and follow the official setup guide.
🍎 iOS Setup
Run
pod installOpen Xcode.
Configure your App ID and associated domains (if using Universal Links).
🚀 Initializing AppsFlyer
import appsFlyer from 'react-native-appsflyer';
appsFlyer.initSdk(
{
devKey: 'YOUR_DEV_KEY',
appId: 'YOUR_APP_ID',
isDebug: true,
onInstallConversionDataListener: true,
onDeepLinkListener: true,
},
() => {
console.log('AppsFlyer initialized');
},
(error) => {
console.log(error);
}
);Initialize the SDK as early as possible — typically during app startup.
📊 Logging Events
AppsFlyer becomes really useful when you log meaningful business events.
Example:
appsFlyer.logEvent('login');Purchase event:
appsFlyer.logEvent('purchase', {
revenue: 499,
currency: 'INR',
});Product view:
appsFlyer.logEvent('view_item', {
product_id: 'iphone-17',
});🎁 Common Events
Most production apps log events like:
- Login
- Signup
- Add to Cart
- View Product
- Search
- Checkout
- Purchase
- Subscription
- Invite Friend
- Level Complete (Games)
- Watch Video
- Share Content
Think of them as breadcrumbs that show how users move through your app.
🔗 Deep Linking
Suppose someone clicks:
myshop://product/iphone17Instead of opening the Home screen… AppsFlyer sends the user directly here:
Product ScreenThe user reaches the content they expected, That’s a much better experience.
🚀 Deferred Deep Linking
This is where AppsFlyer feels like magic.
User clicks an ad, The app isn’t installed.
Get Pradeep Sharma’s stories in your inbox
Join Medium for free to get updates from this writer.
Normally:
Click Ad
│
Install App
│
Home ScreenWith Deferred Deep Linking:
Click Ad
│
Install App
│
AppsFlyer *remembers*
│
Product PageThe app remembers why the user installed it, Marketing teams, Users and Developers love it because support tickets go down.
🌐 What is OneLink?
OneLink is AppsFlyer’s smart URL, Instead of creating different links for Android and iOS:
AppsFlyer automatically routes users to the correct destination.
- bLess maintenance.
- Fewer mistakes.
- More happiness.
🏗 Production Architecture
AppsFlyer works alongside analytics tools — it doesn’t replace them.
🧪 Testing
Turn on Debug Mode.
isDebug: trueWithout Debug Mode:
Everything works.Reality:
Nothing was sent.😅
❌ Common Mistakes
- Initializing Too Late
Don’t initialize AppsFlyer after login.
Initialize it as soon as the app launches.
2. Wrong Dev Key
Everything compiles.
Everything runs.
Nothing appears in the dashboard.
Three hours later…
You discover the Dev Key belongs to another project.
We’ve all been there.
3. Forgetting Native Setup
Every React Native developer eventually says:
yarn addFive minutes later:
Why doesn't Android work?Because React Native still requires native configuration for many SDKs.
4. Not Logging Business Events
Many teams integrate AppsFlyer… Then log only:
App OpenThat’s like buying a Ferrari and only driving it in first gear, Log the events that matter to your business.
💡 Best Practices
- Initialize the SDK during app startup.
- Keep the SDK updated.
- Use standardized event names.
- Validate events in a staging environment before production.
- Avoid logging sensitive user information.
- Test deep links on both Android and iOS.
- Enable debug logs only in development builds.
🤔 When Should You Use AppsFlyer?
Use AppsFlyer if your app:
- Runs paid marketing campaigns.
- Uses Google Ads.
- Uses Meta Ads.
- Uses TikTok Ads.
- Needs deep linking.
- Requires deferred deep linking.
- Wants attribution reporting.
- Tracks marketing ROI.
🚫 When You Probably Don’t Need It
If you’re building:
- An internal employee app.
- A calculator app with no marketing.
- A college project.
- A personal portfolio app.
AppsFlyer might be unnecessary overhead.
Choose tools that fit your product’s needs.
📚 Official Resources
- AppsFlyer Developer Hub: https://dev.appsflyer.com/
- React Native Plugin Documentation: https://dev.appsflyer.com/hc/docs/react-native-plugin
- React Native Plugin GitHub: https://github.com/AppsFlyerSDK/appsflyer-react-native-plugin
- React Native API Reference: https://dev.appsflyer.com/hc/docs/rn_api
- Deep Linking Guide: https://dev.appsflyer.com/hc/docs/unifieddeeplink
- OneLink Documentation: https://dev.appsflyer.com/hc/docs/dl_ios_unified_deep_linking
🎯 Final Thoughts
AppsFlyer won’t make your app faster.
It won’t fix your bugs.
It won’t reduce your bundle size.
It won’t stop your PM from saying,
“Can we ship this by tomorrow?”
😅But it will answer one of the most valuable business questions:
Where did this user come from, and what did they do after installing the app?
That insight helps teams spend marketing budgets wisely, improve onboarding, and understand which campaigns actually drive revenue.
At the end of the day, AppsFlyer isn’t just another SDK — it’s the bridge between marketing data and product analytics, helping developers and marketers speak the same language.
👋 What’s Next?
In the next article, we’ll build a production-ready AppsFlyer integration in React Native with:
- Complete Android setup
- Complete iOS setup
- OneLink configuration
- Deep Linking
- Deferred Deep Linking
- In-App Events
- Testing with real campaigns
- Debugging common issues
- Best practices from production apps
If you found this guide helpful, leave a ❤️ and share it with your fellow React Native developers. Happy coding! 🚀









