Skip to content

Repository files navigation

React Native AppsFlyer plugin for Android and iOS.

πŸ›  In order for us to provide optimal support, we would kindly ask you to submit any issues to support@appsflyer.com

When submitting an issue please specify your AppsFlyer sign-up (account) email , your app ID , production steps, logs, code snippets and any additional relevant information.

npm versionLicense: MITDownloads

Table of content

  • iOS AppsFlyerSDK v6.4.0
  • Android AppsFlyerSDK v6.4.0
  • From version 6.3.0, we use xcframework for iOS platform, then you need to use cocoapods version >= 1.10

  • From version 6.2.30, logCrossPromotionAndOpenStore api will register as af_cross_promotion instead of af_app_invites in your dashboard.
    Click on a link that was generated using generateInviteLink api will be register as af_app_invites.

  • We have renamed the following APIs:

Old APINew API
trackEventlogEvent
trackLocationlogLocation
stopTrackingstop
trackCrossPromotionImpressionlogCrossPromotionImpression
trackAndOpenStorelogCrossPromotionAndOpenStore
setDeviceTrackingDisabledanonymizeUser
AppsFlyerTrackerAppsFlyerLib

And removed the following ones:

  • trackAppLaunch -> no longer needed. See new init guide
  • sendDeepLinkData -> no longer needed. See new init guide
  • enableUninstallTracking -> no longer needed. See new uninstall measurement guide

If you have used 1 of the removed APIs, please check the integration guide for the updated instructions

Production version from npm:

$ npm install react-native-appsflyer --save

Then run the following:

iOS

$ cd ios && pod install
$ react-native run-ios

Android

$ react-native run-android

Starting from RN v0.60, and react-native-appsflyer v1.4.7 the plugin uses autolinking.
If your app does not support autolinking, check out the Installation Guide here.

Starting from version 6.1.10 iOS SDK comes in two variants: Strict mode and Regular mode. Please read more here
Version <= 6.3.0: read this section of the README.md in branch: releases/6.x.x/6.3.x/6.3.0
Change to Strict mode
After you installed the AppsFlyer plugin, add $RNAppsFlyerStrictMode=true in the project's Podfile:

//MyRNApp/ios/Podfile
...
use_frameworks!
$RNAppsFlyerStrictMode=true
# Pods for MyRNApp
...

In the ios folder of your root project Run pod install

Change to Regular mode
Remove $RNAppsFlyerStrictMode=true from the project's Podfile or set it to false:

//MyRNApp/ios/Podfile
...
use_frameworks!
$RNAppsFlyerStrictMode=false //OR remove this line
# Pods for MyRNApp
...

In the ios folder of your root project Run pod install

Initialize the SDK to enable AppsFlyer to detect installations, sessions (app opens) and updates.
NOTE! for iOS 14.5, we use timeToWaitForATTUserAuthorization parameter. Please read more here

importReact,{Component}from'react';import{Platform,StyleSheet,Text,View}from'react-native';importappsFlyerfrom'react-native-appsflyer';appsFlyer.initSdk({devKey: 'K2***********99',isDebug: false,appId: '41*****44',onInstallConversionDataListener: true,//OptionalonDeepLinkListener: true,//OptionaltimeToWaitForATTUserAuthorization: 10//for iOS 14.5},(result)=>{console.log(result);},(error)=>{console.error(error);});
SettingDescription
devKeyYour application devKey provided by AppsFlyer (required)
appIdYour iTunes application ID (iOS only)
isDebugDebug mode - set to true for testing only
onInstallConversionDataListenerSet listener for SDK init response (Optional. default=true)
onDeepLinkListenerSet listener for DDL response (Optional. default=false)
timeToWaitForATTUserAuthorizationTime for the sdk to wait before launch. please read more Here

Great installation and setup guides can be viewed here.

See the full API available for this plugin.

About

AppsFlyer plugin for React Native

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages