react-native-appsflyer is the official React Native plugin for integrating the AppsFlyer mobile attribution and marketing analytics SDK. It provides comprehensive functionalities for tracking installs, in-app events, deep linking, and consent management across iOS and Android platforms. The current stable version is 6.17.9, with frequent patch releases, indicating active development and maintenance. Key differentiators include robust support for purchase validation via the Purchase Connector (since 6.17.1), unified deep linking (UDL), and explicit handling of consent for DMA compliance. The plugin is built for Android AppsFlyer SDK v6.17.6 and iOS AppsFlyer SDK v6.17.9, and is tested with React Native v0.62.0 and above, ensuring compatibility with modern React Native projects. It ships with TypeScript types, facilitating type-safe development.
npm install react-native-appsflyerVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize the AppsFlyer SDK for both iOS and Android, log a custom in-app event (purchase), and set up a listener for Unified Deep Links. Remember to replace placeholder keys.
Update your TypeScript code consuming Purchase Connector data sources to use the new `additionalParameters` object instead of the deprecated functions. Refer to the official documentation for updated interface definitions.
Migrate to the new `AppsFlyerConsent` constructor to manage user consent for data privacy regulations. Consult the 'Send consent for DMA compliance' documentation for the updated API.
Ensure your project's `build.gradle` and environment are updated to support `targetSDKVersion 34`, Java 17, and Gradle 8.7. Check your `android/build.gradle` and `android/app/build.gradle` files for necessary adjustments.
Update your iOS project's minimum deployment target to 12.0 or higher in Xcode (Project -> Target -> General -> Minimum Deployments).
Replace `AppsFlyerConsent.forGDPRUser` or `AppsFlyerConsent.forNonGDPRUser` with the new `AppsFlyerConsent` constructor as per the latest documentation for DMA compliance.
Update your TypeScript code to use the `additionalParameters` object directly on the `PurchaseRevenueDataSource` or `PurchaseRevenueDataSourceStoreKit2` interfaces.
Verify your internet connection. Ensure your `android/build.gradle` file's `allprojects` block includes `mavenCentral()` or `google()` repositories. Sometimes, clearing Gradle cache (`./gradlew clean` and deleting `.gradle` folder in `android/` directory) helps.
Ensure `JAVA_HOME` environment variable points to a valid JDK installation (e.g., OpenJDK 17) and not just a JRE. Reinstalling or updating your JDK and adjusting environment variables is usually required.