​AppsFlyer is an industry-leading mobile attribution and marketing analytics platform, provided as a Software-as-a-Service (SaaS). It offers exciting features to understand your customers better, through intuitive dashboards, real-time data reports, and a unique deep linking technology.
RudderStack allows you to configure AppsFlyer as a destination and send your event data to it directly.
Find the open-source transformer code for this destination in our GitHub repo.
To enable sending data to AppsFlyer, you will first need to add it as a destination to the source from which you are sending your event data. Once the destination is enabled, events from our SDK will start flowing to AppsFlyer.
Before configuring your source and destination on the RudderStack, please verify if the source platform is supported by AppsFlyer, by referring to the table below:
Connection Mode | Web | Mobile | Server |
Device mode | - | Supported | - |
Cloud mode | Supported | Supported | Supported |
To know more about the difference between Cloud mode and Device mode in RudderStack, read the RudderStack connection modes guide.
Once you have confirmed that the platform supports sending events to AppsFlyer, perform the steps below:
From your RudderStack dashboard, add the source. From the list of destinations, select AppsFlyer.
Please follow our guide on How to Add a Source and Destination in RudderStack to add a source and destination in RudderStack.
Give a name to the destination and click on Next. You should then see the following screen:
Enter the AppsFlyer Dev Key.
Apple App ID is the iTunes Application ID, and it is mandatory for iOS applications.
Turn on the Use native SDK to send events
button so that we can send data to AppsFlyer using the native SDK.
Click on Next to complete the configuration.
AppsFlyer should now be added and enabled as a destination in RudderStack.
Depending on your platform of integration, follow these steps below to add AppsFlyer to your project:
To add AppsFlyer to your iOS project:
Add the following line to your CocoaPods Podfile
pod 'Rudder-Appsflyer'
After adding the dependency, you must register the RudderAppsflyerFactory
with your RudderClient
initialization as a factory
of RudderConfig
. To do this, run the following command to import the RudderAppsflyerFactory.h
file in your AppDelegate.m
file.
#import <Rudder-Appsflyer/RudderAppsflyerFactory.h>
Then, change the SDK initialization to the following:
RSConfigBuilder *builder = [[RSConfigBuilder alloc] init];[builder withDataPlaneUrl:DATA_PLANE_URL];[builder withTrackLifecycleEvens:YES];[builder withRecordScreenViews:YES];[builder withFactory:[RudderAppsflyerFactory instance]];[builder withLoglevel:RSLogLevelDebug];[RSClient getInstance:WRITE_KEY config:[builder build]];
To add AppsFlyer to your Android project:
Add the repository as shown:
repositories {maven { url "https://dl.bintray.com/rudderstack/rudderstack" }}
Add the following line to your app/build.gradle
file under dependencies
section:
implementation 'com.rudderstack.android.sdk:core:1.+'implementation 'com.rudderstack.android.integration:appsflyer:1.+'​implementation 'com.appsflyer:af-android-sdk:6.+'implementation 'com.android.installreferrer:installreferrer:2.+'
Finally, change the initialization of your RudderClient
in your Application
class.
val rudderClient: RudderClient = RudderClient.getInstance(this,WRITE_KEY,RudderConfig.Builder().withDataPlaneUrl(DATA_PLANE_URL).withFactory(AppsFlyerIntegrationFactory.FACTORY).build())
To add AppsFlyer to your ReactNative project:
Add the RudderStack-AppsFlyer module to your app using :
npm install @rudderstack/rudder-integration-appsflyer-react-native// OR //yarn add @rudderstack/rudder-integration-appsflyer-react-native
Import the module you added above and add it to your SDK initialization code in the following manner:
import rudderClient from '@rudderstack/rudder-sdk-react-native';import appsflyer from "@rudderstack/rudder-integration-appsflyer-react-native";​const config = {dataPlaneUrl: DATA_PLANE_URL,trackAppLifecycleEvents: true,withFactories: [appsflyer]};rudderClient.setup(WRITE_KEY, config);
The identify
call from RudderStack sets the userId
through the setCustomerUserId
method from AppsFlyerLib
.
RudderStack sets the email
from RudderTraits
to AppsFlyer using the setUserEmails
method from the native SDK.
[[RSClient sharedInstance] identify:@"developer_user_id"traits:@{@"email": @"bar@foo.com"}];
The track
call from RudderStack is mapped to the appropriate standard events of AppsFlyer wherever possible.
We map the events as per the following table:
RudderStack Event | AppsFlyer Event |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Also, for any event with a name not matching the table above, RudderStack makes the following changes to the event name:
Convert the entire event name to lower case
Replace <space>
with <underscore>
After these steps, RudderStack passes the event to AppsFlyer via the native SDK, along with the properties
for that event.
Along with the above event mapping, the event property mapping is done as well, as shown:
RudderStack Property Name | AppsFlyer Property Name |
|
|
|
|
|
|
|
|
|
|
| We formulate the list as per List View specification and pass it to the property |
|
|
|
|
|
|
A Sample track
call for an iOS application will look like the below.
[[RSClient sharedInstance] track:@"Accepted Terms of Service"properties:@{@"foo": @"bar",@"foo_int": @134}];
For all the screen
calls from the SDK, RudderStack calls the trackEvent
method of the AppsFlyer SDK with the eventName
as screen
. Then, all the properties are passed to AppsFlyer as is.
RudderStack performs the same task for the automatically recorded screen
calls as well. For those calls, a Boolean property called automatic
is obtained in the properties.
For all cloud mode calls, the externalId
key must be included and must include the id, as well as the type of appsFlyerExternalId
as shown below:
"externalId": [{"id": "some_other2345_sample_external_id","type": "appsflyerExternalId"}]
We expect the externalId
under context
.
We set the logLevel
in AppsFlyer based on the logLevel
set for the RudderClient
. If it is set for DEBUG
or more, RudderStack sets the logLevel
to VERBOSE
for AppsFlyer. For anything below that, RudderStack sets the logLevel
to NONE
for AppsFlyer.
You can find the AppsFlyer Dev Key by logging into your AppsFlyer account and navigating to the Apps Settings page in your dashboard.
The latest AppsFlyer SDK requires XCode 12. Make sure to meet the requirement. You need to downgrade AppsFlyer SDK to build with a lower version of XCode. You can declare the version with the pod
in your Podfile
pod 'Rudder-Appsflyer',' 1.0.0'
If you come across any issues while configuring AppsFlyer with RudderStack, please feel free to contact us. You can also start a conversation on our Slack channel; we will be happy to talk to you!