Consent mediation simplifies the process of signaling consent to third-party SDKs. It automatically applies consent updates to supported SDKs, helps activate Google Consent Mode, and integrates with advertising and mediation tools (even those outside TCF).
IMPORTANT
Before pushing to production, follow all steps carefully and verify consent is passed correctly.
How consent mediation works
Once correctly implemented, this feature simplifies the transmission of the consent signal and privacy choices to selected third-party SDKs.
However, it is always advisable to review and assess the documentation, privacy policy, and privacy section of third-party vendor SDKs before deciding to work with them or integrating any.
Usercentrics cannot fully guarantee the compliance of collection mechanisms of third-party vendors and SDKs.
In Unity, consent mediation operates by integrating SDKs APIs in order to stream user consent. Most Unity SDKs use a native implementation, serving as a bridge to their respective native platforms. Our approach integrates with these native libraries designed for Android and iOS. The supported SDKs listed below all utilize this integration method. If you encounter a library that doesn't follow a native implementation, please let us know by providing feedback.
Enable consent mediation
Enable mediation with the following snippet:
let options = UsercentricsOptions(settingsId: <SettingsID>, consentMediation: true)val options = UsercentricsOptions(settingsId = <SettingsID>, consentMediation = true)Usercentrics.initialize(
settingsId: <SettingsID>,
consentMediation: true,
);let options: UsercentricsOptions = { settingsId: <SettingsID>, consentMediation: true };To enable consent mediation in Unity, expand the Options menu and mark the checkbox next to Consent Mediation.
.png?sv=2026-02-06&spr=https&st=2026-07-27T20%3A10%3A00Z&se=2026-07-27T20%3A27%3A00Z&sr=c&sp=r&sig=2A639s3X%2BugMI1dNrfb%2B5CyEP3onjSY17SSZTfUID7w%3D)
After enabling mediation with the above, Usercentrics will apply consent automatically to all supported SDKs.
Make sure you apply consent to not supported SDKs as well.
Supported SDKs
IOS and Android supported SDKs
SDK | Supported version | Template ID | Added in | Source |
|---|---|---|---|---|
Google Analytics for Firebase | 21.5.0 (Android) 10.17.0 (iOS) | diWdt4yLB | 2.7.0 | |
Google Analytics Advertising | 21.5.0 (Android) 10.17.0 (iOS) | GqhZxB-iiydzEk | 2.15.1 | |
Unity Ads | 3.7.5 (Android) 4.2.1 (iOS) | hpb62D82I | 2.7.0 | |
AppLovin | 11.4.4 (Android) 11.4.3 (iOS) | fHczTMzX8 | 2.7.0 | |
ironSource | 7.1.10 (Android) 7.3.0 (iOS) | 9dchbL797 | 2.7.0 | |
Crashlytics | 18.3.3 (Android) 10.4.0 (iOS) | cE0B0wy4Z | 2.7.12 | |
Adjust | 5.0.0 (Android and iOS) | Jy6PlrM3 | 2.17.0 | |
Chartboost | 9.5.0 (Android) 9.5.1 (iOS) | IEbRp3saT | 2.11.0 | |
Singular | 12.8.0 (Android) 12.8.0 (iOS) | OxsYgtMfe7aP8u | 2.21.0 | |
AppsFlyer | 6.16.2 (Android) 6.16.2 (iOS) | Gx9iMF__f | 2.21.0 | |
AirBridge | 4.7.0 (Android) 4.7.0 (iOS) | 1k_ljMZc28DDOc | 2.22.2 |
Flutter and React-Native supported SDKs
SDK | Supported version | Template ID | Added in | Source |
|---|---|---|---|---|
AppLovin | 3.8.1 (Flutter) 6.3.1 (React-Native) | fHczTMzX8 | 2.13.3 | Privacy-Consent and Data API for Flutter and React-Native |
ironSource | 1.3.0 (Flutter) 1.1.0 (React-Native) | 9dchbL797 | 2.13.3 | Regulation Advanced Settings for Flutter and React-Native |
Adjust | 4.31.0 (Flutter) 4.38.0 (React-Native) | Jy6PlrM3 | 2.13.3 | Privacy-Consent and Data API for Flutter and React-Native |
Thoroughly review the documentation of each SDK to identify the APIs for accurately signaling user consent. See our implementation guidelines for each SDK mentioned above.
Some SDKs, such as Crashlytics, may automatically collect data by default. Verify whether they offer an API to disable this data collection prior to initialization.
Although most SDKs maintain consistent contracts for Privacy APIs in their updates, any changes must be noted, and the appropriate API should be used accordingly. Rigorous testing is vital for success. While our feature addresses a majority of scenarios, it is imperative that you personally verify the expected behavior in your specific use case.
Warning
Ensure that the version of the SDK in your application matches the one we currently support. In case of any doubt, double check the Integration section in the bottom of this page.
Our integration with SDKs
In this section, we provide a detailed overview of our methods for mediating consents. This initiative is part of our commitment to transparency, offering you clear insights into how we integrate with third-party SDKs to effectively signal user consent.
Google Analytics for Firebase
import FirebaseAnalytics
let consent = .granted || .denied
Analytics.setConsent([
.analyticsStorage: consent
])
Analytics.setAnalyticsCollectionEnabled(true || false)import com.google.firebase.ktx.Firebase
import com.google.firebase.analytics.ktx.analytics
import com.google.firebase.analytics.FirebaseAnalytics.ConsentStatus
val consent = ConsentStatus.GRANTED || ConsentStatus.DENIED
Firebase.analytics.apply {
setConsent {
analyticsStorage(consent)
}
setAnalyticsCollectionEnabled(true || false)
}Google Analytics Advertising for Firebase
import FirebaseAnalytics
let consent = .granted || .denied
Analytics.setConsent([
.adPersonalization: consent,
.adStorage: consent,
.adUserData: consent,
])import com.google.firebase.ktx.Firebase
import com.google.firebase.analytics.ktx.analytics
import com.google.firebase.analytics.FirebaseAnalytics.ConsentStatus
val consent = ConsentStatus.GRANTED || ConsentStatus.DENIED
Firebase.analytics.setConsent {
adPersonalization = consent
adStorage = consent
adUserData = consent
}Unity Ads
import UnityAds
let key = "gdpr.consent" || "privacy.consent"
let consent = true || false
let metaData = UADSMetaData()
metaData.setRaw(key, value: consent)
metaData.commit()import com.unity3d.ads.metadata.MetaData
val key = "gdpr.consent" || "privacy.consent"
val consent = true || false
val metaData = MetaData(context)
metaData.set(key, consent)
metaData.commit()AppLovin
import AppLovinSDK
ALPrivacySettings.setHasUserConsent(true || false)
// or
ALPrivacySettings.setDoNotSell(true || false)import com.applovin.sdk.AppLovinPrivacySettings
AppLovinPrivacySettings.setHasUserConsent(true || false, context)
// or
AppLovinPrivacySettings.setDoNotSell(true || false, context)ironSource
import IronSource
IronSource.setConsent(true || false)
// or
IronSource.setMetaDataWithKey("do_not_sell", value: "NO" || "YES")import com.ironsource.mediationsdk.IronSource
IronSource.setConsent(true || false)
// or
IronSource.setMetaData("do_not_sell", "false" || "true")Crashlytics
import FirebaseCrashlytics
Crashlytics.crashlytics().setCrashlyticsCollectionEnabled(true || false)import com.google.firebase.crashlytics.ktx.crashlytics
import com.google.firebase.ktx.Firebase
Firebase.crashlytics.setCrashlyticsCollectionEnabled(true || false)Adjust
General consent:
import Adjust
Adjust.trackMeasurementConsent(true || false)import com.adjust.sdk.Adjust
Adjust.trackMeasurementConsent(true || false)Third-party SDKs:
import Adjust
let sdkName = "SDKName"
let consent = true || false
let thirdPartySharing = ADJThirdPartySharing.init(isEnabledNumberBool: nil)
thirdPartySharing.addPartnerSharingSetting(sdkName, key: "installs", value: consent)
thirdPartySharing.addPartnerSharingSetting(sdkName, key: "events", value: consent)
thirdPartySharing.addPartnerSharingSetting(sdkName, key: "sessions", value: consent)
Adjust.trackThirdPartySharing(thirdPartySharing)import com.adjust.sdk.AdjustThirdPartySharing
val sdkName = "SDKName"
val consent = true || false
val thirdPartySharing = AdjustThirdPartySharing(null)
thirdPartySharing.addPartnerSharingSetting(sdkName, "install", consent)
thirdPartySharing.addPartnerSharingSetting(sdkName, "events", consent)
thirdPartySharing.addPartnerSharingSetting(sdkName, "sessions", consent)
Adjust.trackThirdPartySharing(thirdPartySharing)Chartboost
import ChartboostSDK
let consent = true || false
let gdprConsent = consent ? CHBDataUseConsent.GDPR.Consent.behavioral : CHBDataUseConsent.GDPR.Consent.nonBehavioral
Chartboost.addDataUseConsent(CHBDataUseConsent.GDPR(gdprConsent))
Chartboost.addDataUseConsent(CHBDataUseConsent.LGPD(allowBehavioralTargeting: consent))
// or
let ccpaConsent = consent ? CHBDataUseConsent.CCPA.Consent.optInSale : CHBDataUseConsent.CCPA.Consent.optOutSale
Chartboost.addDataUseConsent(CHBDataUseConsent.CCPA(ccpaConsent))import com.chartboost.sdk.Chartboost
import com.chartboost.sdk.privacy.model.CCPA
import com.chartboost.sdk.privacy.model.GDPR
import com.chartboost.sdk.privacy.model.LGPD
val consent = true || false
val gpdrConsent = GDPR(if (consent) GDPR.GDPR_CONSENT.BEHAVIORAL else GDPR.GDPR_CONSENT.NON_BEHAVIORAL)
Chartboost.addDataUseConsent(context, gpdrConsent)
Chartboost.addDataUseConsent(context, LGPD(consent))
// or
val ccpaConsent = if (consent) CCPA.CCPA_CONSENT.OPT_IN_SALE else CCPA.CCPA_CONSENT.OPT_OUT_SALE
Chartboost.addDataUseConsent(context, CCPA(ccpaConsent))Singular
import com.singular.sdk.Singular
val consent = true || false
Singular.limitDataSharing(!consent)
if (consent) {
Singular.resumeAllTracking()
Singular.trackingOptIn()
} else {
Singular.stopAllTracking()
}import com.chartboost.sdk.Chartboost
import com.chartboost.sdk.privacy.model.CCPA
import com.chartboost.sdk.privacy.model.GDPR
import com.chartboost.sdk.privacy.model.LGPD
val consent = true || false
val gpdrConsent = GDPR(if (consent) GDPR.GDPR_CONSENT.BEHAVIORAL else GDPR.GDPR_CONSENT.NON_BEHAVIORAL)
Chartboost.addDataUseConsent(context, gpdrConsent)
Chartboost.addDataUseConsent(context, LGPD(consent))
// or
val ccpaConsent = if (consent) CCPA.CCPA_CONSENT.OPT_IN_SALE else CCPA.CCPA_CONSENT.OPT_OUT_SALE
Chartboost.addDataUseConsent(context, CCPA(ccpaConsent))AppsFlyer
import com.appsflyer.AppsFlyerLib
let consent = true || false
switch variant {
case .TCF:
AppsFlyerLib.shared().enableTCFDataCollection(true)
case .GDPR:
let gdprUser = AppsFlyerConsent(
isUserSubjectToGDPR: true,
hasConsentForDataUsage: consent,
hasConsentForAdsPersonalization: consent,
hasConsentForAdStorage: consent
)
AppsFlyerLib.shared().setConsentData(gdprUser)
case .CCPA:
let nonGdprUser = AppsFlyerConsent(
isUserSubjectToGDPR: false,
hasConsentForDataUsage: consent,
hasConsentForAdsPersonalization: consent,
hasConsentForAdStorage: consent
)
AppsFlyerLib.shared().setConsentData(nonGdprUser)
}import com.appsflyer.AppsFlyerConsent
import com.appsflyer.AppsFlyerLib
val consent = true || false
when (variant) {
TCF -> {
AppsFlyerLib.getInstance().enableTCFDataCollection(true)
}
GDPR -> {
val gdprUser = AppsFlyerConsent(
isUserSubjectToGDPR = true,
hasConsentForDataUsage = consent,
hasConsentForAdsPersonalization = consent,
hasConsentForAdStorage = consent
)
AppsFlyerLib.getInstance().setConsentData(gdprUser)
}
CCPA -> {
val nonGdprUser = AppsFlyerConsent(
isUserSubjectToGDPR = false,
hasConsentForDataUsage = consent,
hasConsentForAdsPersonalization = consent,
hasConsentForAdStorage = consent
)
AppsFlyerLib.getInstance().setConsentData(nonGdprUser)
}
}AirBridge
import airbridge-ios-sdk
let consent = true || false
if consent {
AirBridge.startTracking()
} else {
AirBridge.stopTracking()
}import co.ab180.airbridge.Airbridge
val consent = true || false
if (consent) {
Airbridge.startTracking()
} else {
Airbridge.stopTracking()
}Supported mediation SDKs
These SDKs mediate consent for selected SDKs themselves. Make sure you set up the correct TemplateIDs to automatically pass consent to mediated SDKs.
Adjust
Check out Adjust's documentation page to get an insight on the Partners API. Note that we only support the ones listed below.
SDK | Template ID |
|---|---|
Apple Ads | weoN4Lb_MjWLuu |
ocv9HNX_g | |
Google Ads | S1_9Vsuj-Q |
Google Marketing Platform | t-TPeXsRi |
Snapchat | QcD9GVNXZ |
Tencent | tMLzMavbHZoxW0 |
TikTokSan | 6-qobRfu |
Skj79NodobQ | |
Yahoo Gemini | HJSPc4ids-Q |
Yahoo Japan Search | gUbemZYaQwqxss |
Custom DPS
When creating a Custom DPS, its 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 know how to match your Custom DPS with the SDK you are passing consent.
Warning
The setup below must always happen before Usercentrics is initialized.
To do this, we have provided the object UsercentricsMediation. For example if you want to switch the TemplateID for Unity Ads:
UsercentricsMediation.shared.unityAdsTemplateId = "CustomTemplateId"UsercentricsMediation.unityAdsTemplateId = "CustomTemplateId"You can customize the Template ID for SDKs that are mediated by supported SDKs. For example, 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 EnabledScan
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 FirebaseMediation
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: FALSEDefault 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.
Warning
If your workflow necessitates the simultaneous initialization of certain SDKs alongside Usercentrics, be aware of potential racing conditions.
These can arise when the mediation routine is executed while an SDK is still in the process of initialization. To mitigate such issues, we strongly advise initializing SDKs only after obtaining user consent. For more detailed guidance on this approach, refer to our further recommendations here.