Skip to main content

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 the functionality such as tracking, privacy protection, and data analytics requires no additional setup (aside from the BFG SDK). However, you may be granted access to the AppsFlyer dashboard, which allows you to view the incoming data and create custom deep links.

For more information on using AppsFlyer’s features, see:

Enabling AppsFlyer

Enable AppsFlyer in the BFG SDK config file, bfg_config.json:

"appsflyer": {
"is_enabled": true
}
info

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.

By default, the AppsFlyer configuration will default to using Big Fish's dev key, which authenticates events sent by the apps to AppsFlyer. This key is unique per account and 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:

  1. Locate the dependencies section of your app’s build.gradle file.
  2. 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'
...
}
note

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)
warning

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:

  1. Locate and open your app’s main manifest file.
  2. 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), part of Apple iOS, 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. However, you need to add the SKAdNetworkIdentifiers for each ad provider to your .plist file. To do so:

  1. Set up your game in AppsFlyer's dashboard.
  2. Open your game's Info.plist file.
  3. Add an array called SKAdNetworkItems, which contains a dictionary for the allowed ad networks.
  4. For each ad provider, add a dictionary entry using the key SKAdNetworkIdentifier with its associated ID. We recommend you add all the ad providers to Info.plist, regardless of the ones currently used in your game. Click here for a list of all available SKAdNetwork providers and their IDs.
tip

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.

note

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:

  1. In Xcode, select your project, select your target and navigate to the Capabilities tab. If you have multiple targets, repeat this step for each target.
  2. Scroll until you see Associated Domains. Make sure the toggle on the right is set to On.
  3. Press the "+" sign to add an Associated Domain. Add the app link supplied by your Big Fish Producer for your game. The domain should be prefixed with "applinks:"; for example, applinks:bfgsdk.onelink.me.

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 after exporting to Xcode:

<key>FacebookAutoLogAppEventsEnabled</key>
<string>FALSE</string>
<key>FacebookAdvertiserIDCollectionEnabled</key>
<string>FALSE</string>