Consent Management
The Consent Management module is recommended and automatically enabled upon initialization. It is supported on Android mobile and Android TV.
Initialize the consent manager policy inside TealiumConfig
. Then manage user consent using the Tealium instance at tealium.consentManager
.
Learn more about how consent management works.
Consent Expiration
Set the expiration time for the consent selections using the consentExpiry
property.
The following example sets the consent manager policy to GDPR and the expiration time to 90 days:
val config = TealiumConfig(...).apply {
consentManagerPolicy = ConsentPolicy.GDPR
consentExpiry = ConsentExpiry(90, TimeUnit.DAYS)
}
To trigger a callback once the consent has expired, use the onUserConsentPreferencesUpdated()
method to check when the ConsentStatus
is UNKNOWN
:
Tealium.create(BuildConfig.TEALIUM_INSTANCE, config) {
events.subscribe(object : UserConsentPreferencesUpdatedListener {
override fun onUserConsentPreferencesUpdated(userConsentPreferences: UserConsentPreferences,
policy: ConsentManagementPolicy) {
if (userConsentPreferences.consentStatus == ConsentStatus.UNKNOWN) {
Logger.dev(BuildConfig.TAG, "Re-prompt for consent")
}
}
})
}
Set a Policy
Set the consent policy
during initialization to one of the following:
ConsentPolicy.GDPR
ConsentPolicy.CCPA
Only one policy can be enforced at a time.
val config = TealiumConfig(...).apply {
consentManagerPolicy = ConsentPolicy.GDPR
}
Set Full Consent
To set full consent:
tealium.consentManager.userConsentStatus = ConsentStatus.CONSENTED
Setting full consent implicitly sets the consent categories to the full list of available ConsentCategory
types.
Set Partial Consent by Category
To set partial consent, specify a subset of consent categories. This implicitly sets userConsentStatus
to CONSENTED
.
tealium.consentManager.userConsentCategories = setOf(ConsentCategory.ANALYTICS, ConsentCategory.EMAIL)
Set Declined Consent
To decline consent set the consent status:
tealium.consentManager.userConsentStatus = ConsentStatus.NOT_CONSENTED
Alternatively, set the consent categories to null
.