AppsFlyer Delegate
Important Do not enable AppsFlyer reporting in Echo unless you have been asked to do so.
This delegate reports marketing campaign events to AppsFlyer. At time of writing AppsFlyer integration is available for iOS and Android only.
Table of contents
AppsFlyer & iOS
Integration via Podfile
Because Apple have a strict privacy stance, you must not include the AppsFlyer SDK if you are not explicitly reporting marketing events. It will result in your app failing the App Store review. As such it is not a part of Echo as standard and there is a specific pod subspec to use if you need to include it.
Here is an example Podfile that includes Echo with the WithAppsFlyer
subspec specified:
# This is required as Echo is published to the MAP repo
source 'git@github.com:bbc/map-ios-podspecs.git'
target 'MyApp' do
use_frameworks!
# Change the version number (x.x.x) as appropriate
pod 'echo-client-ios-swift/WithAppsFlyer', '~> x.x.x'
end
After adding the Echo dependency to your Podfile
, run pod install
to add Echo to your project.
If you do not want to include AppsFlyer within your build then you can include Echo as you normally would (see iOS integration)
AppsFlyer & Android
Android Manifest (XML)
Google AD_ID
Echo does not include an addition in the Android Manifest. App teams will have to set or revoke this permission according to their needs. The following code example shows how to set this permission in your AndroidManifest.xml:
<uses-permission android:name="com.google.android.gms.permission.AD_ID" />
Revoking the AD_ID permission
To build Echo without AD_ID, you can revoke this permission by adding the following code to the Manifest file.
<uses-permission android:name="com.google.android.gms.permission.AD_ID"
tools:node="remove"/>
Note: the following guidance, “According to Google’s Policy, apps that target children must not transmit the Advertising ID”. See AppsFlyer’s documentation and Google’s documentation for more information.
Enabling AppsFlyer reporting
In addition to the pod spec, you must enable the AppsFlyer delegate and provide your App ID.
var config:Dictionary<EchoConfigKey, String>
config[.appsFlyerEnabled] = true
config[.appsFlyerAppID] = "<APPLE_APP_ID>"
// Instantiate Echo Client
do {
echo = try EchoClient(appName: "AppName",
appType: .mobileApp,
config: config,
bbcUser: user)
} catch {
// Handle Echo config error
}
private HashMap<String,String> config;
config.put(EchoConfigKeys.APPSFLYER_ENABLED, "true");
config.get(EchoConfigKeys.APPSFLYER_APP_ID, "<APP_ID>");
// Instantiate EchoClient
EchoClient echo = new EchoClient(
"MyApp", // App Name
ApplicationType.MOBILE, // App type
"echo.android.test", // App Countername
getApplicationContext(), // The Android Context of your Application
config, // config options HashMap
bbcUser, // BBCUser instance
this // Application instance of your Application
);
AppsFlyer will be initialised either when you initialise Echo (if you provide a signed-in user with personalisation enabled at initialisation), or when a user signs in for the first time and has personalisation enabled.
Reporting AV play events via BAG
Note: the following information has been updated for Echo iOS 7.0.0 and Echo Android 20.0.0. For previous versions, the only config key you need to set is bbcGatewayEnabled/BBC_GATEWAY_ENABLED.
In order to report AV play events to AppsFlyer we need to send them via the BBC Activity Gateway.
This requires enabling BAG AV reporting, and notifying Echo of your play event in the usual way. Enable BAG reporting with the following config:
var config:Dictionary<EchoConfigKey, String>
config[.bbcGatewayEnabled] = "true"
config[.bbcGatewayAVReportingEnabled] = "true"
config[.appsFlyerAppID] = "id1100110011"
private HashMap<String,String> config;
config.put(EchoConfigKeys.BBC_GATEWAY_ENABLED, "true");
config.put(EchoConfigKeys.BBC_GATEWAY_AV_REPORTING_ENABLED, "true");
config.put(EchoConfigKeys.APPSFLYER_APP_ID, "id=com.bbc.yourappname");
The APPSFLYER_APP_ID is required by the BBC Activity Gateway (BAG) for AV reporting purposes. Its format must be correct and be prefixed with `id`. You can find your app ID by visiting your app in the App Store and copying the ID from the end of the URL.
For example, using Sounds:
Android: id=com.bbc.sounds from https://play.google.com/store/apps/details?id=com.bbc.sounds
iOS: id1380676511 from https://apps.apple.com/gb/app/id1380676511
Please refer to "app.id" in BAG's documentation for more information.
Additionally the bbcUser object, provided when initialising Echo, must contain an accessToken and identityToken. These tokens are also required by the BBC Activity Gateway (BAG) for AV reporting purposes, as the user.id is extracted from them.
You can find examples of how to provide these to Echo in our User Tracking and Privacy page.
Please refer to "user.id" in BAG's documentation for more information.