AppsFlyer
AppsFlyer is a marketing and data analytics tool that gives visibility into campaign performance and app installs, while providing deep linking solutions.
With AppsFlyer, you can:
- Track and attribute the install and post-install events for all marketing channels
- Create deep links from within your game
- Measure the success of your game’s campaigns
- Optimize campaign spending
AppsFlyer is integrated directly into the BFG SDK, and most of its functionality including tracking, privacy protection, and data analytics is set up in the BFG SDK. Additionally, you may be granted access to the AppsFlyer dashboard, where you can view the incoming data and create custom deep links.
For more information on using AppsFlyer’s features, see:
Enabling AppsFlyer
Each game is assigned an "Application Store ID" (also known as “App ID” or “App Store ID”) to uniquely identify the app in the Apple App Store and/or Google Play Store. This ID is required for all BFG SDK services to work, including AppsFlyer. Ensure that the app_id
is set in your BFG SDK config file before continuing.
Enable AppsFlyer in the BFG SDK config file, bfg_config.json:
"appsflyer": {
"is_enabled": true
}
By default, the AppsFlyer configuration will default to using Big Fish's dev key. The dev key authenticates events sent by the apps to AppsFlyer and is unique to each account. The same dev key is used by all apps in the account. If your game requires a game-specific dev key for its attribution tracking, you can set this in bfg_config.json:
"appsflyer": {
"is_enabled": true,
"devkey": your_game_dev_key_here
}
Additional steps for Android
Update your Gradle dependencies
In your app’s build.gradle
file, add an entry for AppsFlyer:
- Locate the dependencies section.
- Add the following new section to the dependencies. Note that the following example uses placeholders, and you need to replace the following
X.X.X
with the appropriate version of AppsFlyer.
dependencies {
...
implementation 'com.appsflyer:af-android-sdk:X.X.X'
implementation 'com.android.installreferrer:installreferrer:2.2'
...
}
The com.android.installreferrer:installreferrer:2.2
dependency is required to support Google's Play Install Referrer API. Using this API improves attribution accuracy, protects from install fraud, and more.
Developers who are using ProGuard and want to use Google's Play Install Referrer API ↗️ must also set the following ProGuard rule: -dontwarn com.android.installreferrer
Update your manifest with CHANNEL entry (Amazon Only)
The following section applies only to Amazon builds. Do not include this entry for any Google builds.
AppsFlyer requires a "CHANNEL" entry in your manifest file for out-of-store apps, like Amazon. Therefore, for Amazon builds only, perform this additional setup:
- Locate and open your app’s main manifest file.
- In the application section of your main manifest file, add the following entry:
<meta-data android:name="CHANNEL" android:value="Amazon" />
Additional steps for iOS
Add support for SKAdNetwork (SKAN)
SKAdNetwork (SKAN) lets advertisers measure campaign performance while simultaneously preserving user privacy. AppsFlyer uses SKAN to reliably track install attribution and takes care of all implementation details. Additionally, you need to add the SKAdNetworkIdentifiers for each ad provider to your .plist
file. To do so:
- Set up your game in AppsFlyer's dashboard.
- Open your game's
Info.plist
file. - Add an array called
SKAdNetworkItems
, which contains a dictionary for the allowed ad networks. - For each ad provider, add a dictionary entry using the key
SKAdNetworkIdentifier
with its associated ID. We recommend you add all the ad providers toInfo.plist
, regardless of the ones currently used in your game. Click here for a list of all available SKAdNetwork providers and their IDs ↗️.
To generate a list of all SKAdNetworkIdentifiers in this spreadsheet, select the BFG menu in Google Sheets. From there, you can generate a JSON file or string array to use in your array.
Here is an example of an abbreviated Info.plist
file:
<key>SKAdNetworkItems</key>
<array>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>example100.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>example200.skadnetwork</string>
</dict>
</array>
Provisioning devices and setting up Associated Domains
If you need to test AppsFlyer locally, your Big Fish producer will provide a provisioning profile with Associated Domains enabled. Install this provisioning profile and ensure that it is selected for each of your build targets. After you submit your game, the Associated Domains will be updated by Big Fish.
Associated Domains must be configured properly for marketing links to work.
Once Associated Domains are enabled in your provisioning profile, add your specific AppsFlyer domain value:
- In Xcode, select your project, then select your target and navigate to the Capabilities tab. If you have multiple targets, repeat this step for each target.
- Scroll until you see Associated Domains. Make sure the toggle on the right is set to On.
- Click the "+" (plus) symbol to add a new Associated Domain. Add the app link supplied by your Big Fish producer. The domain should be prefixed with "applinks:", such as
applinks:bfgsdk.onelink.me
.
Alternatively, you can add associated domains automatically using an Entitlements file.
Removing Facebook SDK event warnings
The Facebook SDK, which is integrated into the BFG SDK, automatically reports certain events for its apps. To prevent duplication of these events, the BFG SDK programmatically disables the Facebook SDK automatic reporting. As a result, you may see warnings for FacebookAutoLogAppEventsEnabled
and FacebookAdvertiserIDCollectionEnabled
. These warnings can safely be ignored.
However, if you want to address them, set the following in your game's .plist
file after exporting to Xcode:
<key>FacebookAutoLogAppEventsEnabled</key>
<string>FALSE</string>
<key>FacebookAdvertiserIDCollectionEnabled</key>
<string>FALSE</string>