[iOS] 3rd Party App Attribution Partners (AAPs)
Overview
For our clients that integrate our CMP SDK along with one of the following 3rd-party SDKs, we've composed this document where you'll find individual guides that will demonstrate how consents collected using our CMP SDK are passed to these SDKs. Our CMP is fully compatible with TCF v2.2, and it collects DMA consent data and stores it in UserDefaults
. Some of the SDKs below can fetch this data automatically, and some require some code. Please check below the individual use cases.
Strictly follow the order of the different SDKs calls. Our CMP SDK must collect users' consent prior to invoking any action whatsoever in the third-party SDKs below.
On some SDKs from providers like AppsFlyer, AdJust and branch you'll need to either (a) invoke our updateThirdPartyConsent()
method, which will automatically pass the collected consents to these SDKs via introspection/reflection, or (b) use their own methods and properties to do it manually. In case you're using our CMP SDK to automatically handle the pass of the consent data, here's an example of implementation:
@main
class AppDelegate: UIResponder, UIApplicationDelegate, CMPManagerDelegate {
var window: UIWindow?
var cmpManager: CMPManager!
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Initialize your third-party SDK. Replace the code below by your respective third-party init code
// according to the instructions along this document
let yourClientToken = "YOUR-CLIENT-TOKEN"
let yourThirdPartySdk = YourThirdPartySdk.shared()
yourThirdPartySdk.initialize(withToken: yourClientToken)
// Initializing our CMP SDK
let urlConfig = UrlConfig(
id: "YOUR_CODE_ID_HERE",
domain: "delivery.consentmanager.net",
language: "EN",
appName: "CMDemoAppSwift"
)
let webViewConfig = ConsentLayerUIConfig()
cmpManager = CMPManager.shared
cmpManager.delegate = self
cmpManager.setUrlConfig(urlConfig)
cmpManager.setWebViewConfig(webViewConfig)
// Set the root view controller for consent UI presentation
if let rootViewController = window?.rootViewController {
cmpManager.setPresentingViewController(rootViewController)
}
// Here our CMP SDK will automatically display the consent layer if there is no consent
// or the consent is expired. The didReceiveConsent() callback below will be triggered
// once user consent is collected, which happens right after the users accepts/rejects
// and all IAB TCF data is persisted to the UserDefaults area
checkAndOpenConsent()
return true
}
func checkAndOpenConsent() {
cmpManager.checkAndOpen { error in
if let error = error {
print("Error checking consent: \(error.localizedDescription)")
}
}
}
// MARK: - CMPManagerDelegate Methods
func didReceiveConsent(consent: String, jsonObject: [String: Any]) {
print("CMP DemoApp: Consent Layer successfully received consent message.")
// Here we'll automatically handle the passing of the consent from our
// CMP SDK to the 3P SDK
let results = cmpManager.updateThirdPartyConsent()
print("Third-party consent update results: \(results)")
}
}
For further information, proceed to the respective third-party instructions below.
AppsFlyer
This SDK searches for TCF string stored inside the UserDefaults
area of the device, providing automatic flow of the consents collected on the device via our CMP SDK to AppsFlyer events. In order to pass consent data to AppsFlyer, please follow the instructions below:
- Initialize the AppsFlyer SDK and enable TCF data collection. On the code presented on the Overview section of this document, replace the third-party initialization part with:
AppsFlyerLib.shared().waitForATTUserAuthorization(timeoutInterval: 60)
AppsFlyerLib.shared().enableTCFDataCollection(true)
- Initialize our CMP SDK
- Use our CMP SDK to automatically decide if you need the consent dialog in the current session.
- If needed, consent dialog will be displayed to capture the user consent choices, be it accept all, reject all or customize choices.
- Get confirmation from the CMP that the user has made their consent decision, and the data is available in
UserDefaults
. There are different ways of doing this with our CMP SDK. In the example on the overview, we're using thedidReceiveConsent()
callback to achieve this. - The last step can be performed in two ways: (a) you can follow our code chunk from the overview or (b) you can replace it by AppFlyer's
start()
method. In the latter case, replace the line inside ourdidReceiveMessage
callback by the the line below:
AppsFlyerLib.shared().start()
AdJust
This SDK does not retrieve consent data stored inside the UserDefaults
area of the device, so you have two ways of achieving this feat: (a) automatic, which will be completely handled by our CMP SDK; and (b) manual, where you'll use both SDKs features to achieve this. Please follow the instructions below:
- Initialize the AdJust SDK
- Initialize our CMP SDK
- Use our CMP SDK to automatically decide if you need the consent dialog in the current session.
- If needed, consent dialog will be displayed to capture the user consent choices, be it accept all, reject all or customize choices.
- Get confirmation from the CMP that the user has made their consent decision, and the data is available in
UserDefaults
. There are different ways of doing this with our CMP SDK. In the example below, we're using thedidReceiveConsent()
callback to illustrate. - As a last step, you can either (a) invoke the
updateThirdPartyConsent()
method from our CMP SDK, which will automatically pass the data to AdJust's SDK via introspection/reflection or replace it by the code below:
func didReceiveConsent(consent: String, jsonObject: [String: Any]) {
print("CMP DemoApp: Consent Layer successfully received consent message.")
// Retrieve Google Consent Mode data...
let consentData = cmpManager.getGoogleConsentModeStatus()
// ... and parse it to pass to Adjust SDK
let adStorageConsent = consentData["ad_storage"] == "granted" ? "1" : "0"
let adPersonalizationConsent = consentData["ad_personalization"] == "granted" ? "1" : "0"
let adjustThirdPartySharing = ADJThirdPartySharing(isEnabled: true)
adjustThirdPartySharing?.addGranularOption("google_dma", key: "eea", value: "1")
adjustThirdPartySharing?.addGranularOption("google_dma", key: "ad_personalization", value: adPersonalizationConsent)
adjustThirdPartySharing?.addGranularOption("google_dma", key: "ad_user_data", value: adStorageConsent)
Adjust.trackThirdPartySharing(adjustThirdPartySharing)
}
Branch
This SDK does not retrieve consent data stored inside the UserDefaults
area of the device, so you have two ways of achieving this feat: (a) automatic, which will be completely handled by our CMP SDK; and (b) manual, where you'll use both SDKs features to achieve this.
- Initialize Branch using your app token
- Initialize our CMP SDK
- Use our CMP SDK to automatically decide if you need the consent dialog in the current session.
- If needed, consent dialog will be displayed to capture the user consent choices, be it accept all, reject all or customize choices.
- Get confirmation from the CMP that the user has made their consent decision, and the data is available in
UserDefaults
. There are different ways of doing this with our CMP SDK. In the example below, we're using thedidReceiveConsent()
callback to illustrate. - As a last step, you can either (a) invoke the
updateThirdPartyConsent()
method from our CMP SDK, which will automatically pass the data to AdJust's SDK via introspection/reflection or replace it by the code below:
override fun didReceiveConsent(consent: String, jsonObject: Map<String, Any>) {
Log.d("CMP DemoApp", "Consent Layer successfully received consent message.")
// Retrieve Google Consent Mode data...
val consentData = cmpManager.getGoogleConsentModeStatus();
// ... and parse it to pass to AdJust SDK
val adStorageConsent = consentSettings["ad_storage"] == "granted"
val adPersonalizationConsent = consentSettings["ad_personalization"] == "granted"
// Example for an EEA resident
Branch.getInstance().setDMAParamsForEEA(true,adPersonalizationConsent,adStorageConsent)
// Example for an non-EEA resident
Branch.getInstance().setDMAParamsForEEA(false,adPersonalizationConsent,adStorageConsent)
// For further information, check:
// https://help.branch.io/developers-hub/docs/ios-advanced-features#user-data
}
Kochava
This SDK searches for TCF string stored inside the UserDefaults
area of the device, providing automatic flow of the consents collected on the device via our CMP SDK to AppsFlyer events. In order to pass consent data to AppsFlyer, please follow the instructions below:
- Initialize the Kochava SDK
- Initialize our CMP SDK
- Use our CMP SDK to automatically decide if you need the consent dialog in the current session.
- If needed, consent dialog will be displayed to capture the user consent choices, be it accept all, reject all or customize choices.
- Get confirmation from the CMP that the user has made their consent decision, and the data is available in
UserDefaults
. There are different ways of doing this with our CMP SDK. In the example on the overview, we're using thedidReceiveConsent()
callback to achieve this. - The last step can be performed in two ways: (a) you can follow our code chunk from the overview or (b) you can replace it by Kochava's
startWithAppGuid()
method. In the latter case, replace the line inside ourdidReceiveMessage
callback by the the line below:
Tracker.getInstance().startWithAppGuid(applicationContext, "YOUR_ANDROID_APP_GUID")
Singular
This SDK searches for TCF string stored inside the UserDefaults
area of the device, providing automatic flow of the consents collected on the device via our CMP SDK to AppsFlyer events. In order to pass consent data to AppsFlyer, please follow the instructions below:
- Initialize the Singular SDK
- Initialize our CMP SDK
- Use our CMP SDK to automatically decide if you need the consent dialog in the current session.
- If needed, consent dialog will be displayed to capture the user consent choices, be it accept all, reject all or customize choices.
- Get confirmation from the CMP that the user has made their consent decision, and the data is available in
UserDefaults
. There are different ways of doing this with our CMP SDK. In the example on the overview, we're using thedidReceiveConsent()
callback to achieve this. - The last step can be performed in two ways: (a) you can follow our code chunk from the overview or (b) you can replace it by Singular's
trackingOptIn()
method. In the latter case, replace the line inside ourdidReceiveMessage
callback by the the line below:
Singular.trackingOptIn();
AirBridge
This SDK searches for TCF string stored inside the UserDefaults
area of the device, providing automatic flow of the consents collected on the device via our CMP SDK to AppsFlyer events. In order to pass consent data to AppsFlyer, please follow the instructions below:
- Initialize the AirBridge SDK
- Initialize our CMP SDK
- Use our CMP SDK to automatically decide if you need the consent dialog in the current session.
- If needed, consent dialog will be displayed to capture the user consent choices, be it accept all, reject all or customize choices.
- Get confirmation from the CMP that the user has made their consent decision, and the data is available in
UserDefaults
. There are different ways of doing this with our CMP SDK. In the example on the overview, we're using thedidReceiveConsent()
callback to achieve this. - The last step can be performed in two ways: (a) you can follow our code chunk from the overview or (b) you can replace it by AirBridge's
startTracking()
method. In the latter case, replace the line inside ourdidReceiveMessage
callback by the the line below:
Airbridge.startTracking()
Tenjin
This SDK searches for TCF string stored inside the UserDefaults
area of the device, providing automatic flow of the consents collected on the device via our CMP SDK to AppsFlyer events. In order to pass consent data to AppsFlyer, please follow the instructions below:
- Initialize the Tenjin SDK
- Initialize our CMP SDK
- Use our CMP SDK to automatically decide if you need the consent dialog in the current session.
- If needed, consent dialog will be displayed to capture the user consent choices, be it accept all, reject all or customize choices.
- Get confirmation from the CMP that the user has made their consent decision, and the data is available in
UserDefaults
. There are different ways of doing this with our CMP SDK. In the example on the overview, we're using thedidReceiveConsent()
callback to achieve this. - The last step can be performed in two ways: (a) you can follow our code chunk from the overview or (b) you can replace it by Tenjin
optIn()/optOut()
methods.