Skip to content

Consent Mediation

BETA

This feature is currently in beta, and only available starting v2.7.0. Please make sure that consent is being passed correctly before pushing this feature to production.

To simplify the process of applying consent, we are adding a mediation feature, that is aware of the Consent API of selected SDKs, and will apply/update consent whenever needed.

Enable Mediation

let options = UsercentricsOptions(settingsId: <SettingsID>, consentMediation: true)
val options = UsercentricsOptions(settingsId = <SettingsID>, consentMediation = true)
}

Done 🚀

That's it, the Usercentrics SDK will now apply consent automatically to all supported SDKs based on their Template ID, if you use Custom DPSs, please make sure you modify the TemplateID as shown below. Make sure you apply consent to NOT supported SDKs as well.

Supported SDKs

SDK Template ID Added in version Source
Google Analytics for Firebase diWdt4yLB 2.7.0 Google's Consent Mode
Unity Ads hpb62D82I 2.7.0 Privacy consent and data APIs
AppLovin fHczTMzX8 2.7.0 Privacy-Consent and Data API for iOS and Android
ironSource 9dchbL797 2.7.0 Regulation Advanced Settings for iOS and Android
Crashlytics cE0B0wy4Z 2.7.12 Privacy-Consent and Data API for iOS and Android
Adjust Jy6PlrM3 2.7.12 Privacy-Consent and Data API for iOS and Android

Supported Mediation SDKs

Adjust

SDK Template ID
Apple Ads weoN4Lb_MjWLuu
Facebook ocv9HNX_g
Google Ads S1_9Vsuj-Q
Google Marketing Platform t-TPeXsRi
Snapchat QcD9GVNXZ
Tencent tMLzMavbHZoxW0
TikTokSan 6-qobRfu
Twitter Skj79NodobQ
Yahoo Gemini HJSPc4ids-Q
Yahoo Japan Search gUbemZYaQwqxss

Custom DPS

When creating a Custom DPS, it's Template ID will be new and unique. For this reason, if you want to use Consent Mediation, you need to modify the default Template ID we provide in the tables above. you will need to provide this information to our SDK for Consent Mediation to how to match your Custom DPS with the SDK you are passing consent.

To do this, we have provided the object UsercentricsMediation. e.g. If you want to switch the TemplateID for Unity Ads:

Important Note

The setup below should always happen before Usercentrics is initialized

UsercentricsMediation.shared.unityAdsTemplateId = "CustomTemplateId"
UsercentricsMediation.unityAdsTemplateId = "CustomTemplateId"

You can customize the Template ID for SDKs that are mediated by supported SDKs. e.g SDKs that are mediated by Adjust:

UsercentricsMediation.adjust.shared.snapchatTemplateId = "CustomTemplateId"
UsercentricsMediation.adjust.snapchatTemplateId = "CustomTemplateId"

Debugging

Debug Mode

To see debug messages, please set the SDK's loggerLevel to DEBUG.

When running your application with Consent Mediation enabled, you should expect the following events:

Enable Confirmation

Immediately after initialization, you will get a confirmation that Consent Mediation is Enabled:

[USERCENTRICS] Consent Mediation is Enabled

Scan

After your configuration has been loaded, the SDK will provide an overview of the supported services:

[USERCENTRICS][Mediation] 2/6 Services are supported: Unity Ads | Google Analytics for Firebase
Mediation

Whenever a user provides consent or the SDK has been initialized, the SDK will apply the latest user choices to each supported SDK:

[USERCENTRICS][Mediation] ✅ Google Analytics for Firebase: TRUE
[USERCENTRICS][Mediation] ✅ Unity Ads: FALSE

Default Consent

On first launch, you will see consent is applied immediately after initialization, even when a user still has not given consent. This happens because the default consent provided in your configuration is being applied.