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.
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: "cdn.iubenda.com",
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)")
}
}
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:
AppsFlyerLib.shared().waitForATTUserAuthorization(timeoutInterval: 60)
AppsFlyerLib.shared().enableTCFDataCollection(true)
UserDefaults
. There are different ways of doing this with our CMP SDK. In the example on the overview, we’re using the didReceiveConsent()
callback to achieve this. start()
method. In the latter case, replace the line inside our didReceiveMessage
callback by the the line below: AppsFlyerLib.shared().start()
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:
UserDefaults
. There are different ways of doing this with our CMP SDK. In the example below, we’re using the didReceiveConsent()
callback to illustrate. 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)
}
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.
UserDefaults
. There are different ways of doing this with our CMP SDK. In the example below, we’re using the didReceiveConsent()
callback to illustrate. 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
}
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:
UserDefaults
. There are different ways of doing this with our CMP SDK. In the example on the overview, we’re using the didReceiveConsent()
callback to achieve this. startWithAppGuid()
method. In the latter case, replace the line inside our didReceiveMessage
callback by the the line below: Tracker.getInstance().startWithAppGuid(applicationContext, "YOUR_ANDROID_APP_GUID")
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:
UserDefaults
. There are different ways of doing this with our CMP SDK. In the example on the overview, we’re using the didReceiveConsent()
callback to achieve this. trackingOptIn()
method. In the latter case, replace the line inside our didReceiveMessage
callback by the the line below: Singular.trackingOptIn();
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:
UserDefaults
. There are different ways of doing this with our CMP SDK. In the example on the overview, we’re using the didReceiveConsent()
callback to achieve this. startTracking()
method. In the latter case, replace the line inside our didReceiveMessage
callback by the the line below: Airbridge.startTracking()
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:
UserDefaults
. There are different ways of doing this with our CMP SDK. In the example on the overview, we’re using the didReceiveConsent()
callback to achieve this. optIn()/optOut()
methods.