{"library":"react-native-appsflyer","title":"AppsFlyer React Native SDK","description":"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.","language":"javascript","status":"active","last_verified":"Tue Apr 21","install":{"commands":["npm install react-native-appsflyer"],"cli":null},"imports":["import appsFlyer from 'react-native-appsflyer';","import { AppsFlyerConsent } from 'react-native-appsflyer';","import type { DeepLinkResult } from 'react-native-appsflyer';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import appsFlyer from 'react-native-appsflyer';\nimport { Platform } from 'react-native';\nimport type { DeepLinkResult } from 'react-native-appsflyer';\n\nconst appsFlyerDevKey = process.env.APPSFLYER_DEV_KEY ?? 'YOUR_APPSFLYER_DEV_KEY';\n// iOS App ID is required for iOS initialization\nconst appleAppID = Platform.OS === 'ios' ? (process.env.APPLE_APP_ID ?? 'YOUR_APPLE_APP_ID') : '';\n\nappsFlyer.initSdk(\n  {\n    devKey: appsFlyerDevKey,\n    isDebug: true,\n    appId: appleAppID, // Only for iOS. Ensure this is a string.\n    // Add conversion data and deep link listeners here if needed\n    // onInstallConversionDataListener: (data) => console.log('Install Conversion Data:', data),\n    // onDeepLinkListener: (result) => console.log('Deep Link Listener Data:', result),\n  },\n  (success) => {\n    console.log('AppsFlyer SDK initialized successfully:', success);\n    // Log a custom in-app event, e.g., a purchase\n    appsFlyer.logEvent(\n      'af_purchase',\n      {\n        af_content_id: 'product_id_123',\n        af_content_type: 'product',\n        af_currency: 'USD',\n        af_price: 29.99,\n        af_revenue: 29.99,\n      },\n      (eventSuccess) => console.log('Purchase event logged:', eventSuccess),\n      (eventError) => console.error('Error logging purchase event:', eventError)\n    );\n  },\n  (error) => {\n    console.error('AppsFlyer SDK initialization failed:', error);\n  }\n);\n\n// Example of setting up a global deep link listener\nappsFlyer.onDeepLink(\n  (res: DeepLinkResult) => {\n    console.log('Unified Deep Link received:', res);\n    // Implement deep link routing logic here\n    if (res.status === 'FOUND' && res.deepLink) {\n      console.log('Deep link data:', res.deepLink);\n    }\n  }\n);\n","lang":"typescript","description":"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.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}