IAB TCF 2.2
Overview
TCF v2.2 enables consumers to grant or withhold consent and also exercise their ‘right to object’ to data being processed. Consumers also gain more control over whether and how vendors may use certain features of data processing, for example, the use of precise geolocation.
Publishers employing TCF v2.2 gain greater control and flexibility with respect to how they integrate and collaborate with their technology partners. New publisher functionality allows them to restrict the purposes for which personal data is processed by vendors on a publisher’s website on a per-vendor basis.
What Is The Transparency & Consent Framework (TCF)?
The TCF’s simple objective is to help all parties in the digital advertising chain ensure that they comply with the EU’s GDPR and ePrivacy Directive when processing personal data or accessing and/or storing information on a user’s device, such as cookies, advertising identifiers, device identifiers and other tracking technologies.
OneTrust Configuration guidelines
OneTrust helps you to configure the IAB TCF version for your application by building the IAB template in OneTrust’s environment.
Accessing IAB TCF data
Once user gives consent, OneTrust retrieve the IAB TCF data and save it to the Android’s default SharedPreferences based on the IAB version your application is compliant with. Your application can access the data by fetching it using following keys from default sharedpreferences.
The TC data values can be retrieved from the application Shared Preferences by key name using the get methods on the android.content.SharedPreferences class. For the purposes of accessing TC data, only two methods should be necessary: getString(String key, String defValue) for String values and getInt(String key, int defValue) for integers and integer representations of Boolean values.
IAB TCF Keys
IAB TCF Keys | OT Keys | IAB Version |
---|---|---|
IABTCF_CmpSdkID | OTIABTCFKeys.IABTCF_CMPSDKID | IAB2 Key |
IABTCF_CmpSdkVersion | OTIABTCFKeys.IABTCF_CMPSDKVERSION | IAB2 Key |
IABTCF_PolicyVersion | OTIABTCFKeys.IABTCF_POLICYVERSION | IAB2 Key |
IABTCF_gdprApplies | OTIABTCFKeys.IABTCF_GDPRAPPLIES | IAB2 Key |
IABTCF_PublisherCC | OTIABTCFKeys.IABTCF_PUBLISHERCC | IAB2 Key |
IABTCF_PurposeOneTreatment | OTIABTCFKeys.IABTCF_PURPOSEONETREATMENT | IAB2 Key |
IABTCF_UseNonStandardStacks | OTIABTCFKeys.IABTCF_USENONSTANDARDSTACKS | IAB2 Key |
IABTCF_TCString | OTIABTCFKeys.IABTCF_TCSTRING | IAB2 Key |
IABTCF_VendorConsents | OTIABTCFKeys.IABTCF_VENDORCONSENTS | IAB2 Key |
IABTCF_VendorLegitimateInterests | OTIABTCFKeys.IABTCF_VENDORLEGITIMATEINTERESTS | IAB2 Key |
IABTCF_PurposeConsents | OTIABTCFKeys.IABTCF_PURPOSECONSENTS | IAB2 Key |
IABTCF_PurposeLegitimateInterests | OTIABTCFKeys.IABTCF_PURPOSELEGITIMATEINTERESTS | IAB2 Key |
IABTCF_SpecialFeaturesOptIns | OTIABTCFKeys.IABTCF_SPECIALFEATURESOPTINS | IAB2 Key |
IABTCF_PublisherConsent | OTIABTCFKeys.IABTCF_PUBLISHERCONSENT | IAB2 Key |
IABTCF_PublisherLegitimateInterests | OTIABTCFKeys.IABTCF_PURPOSELEGITIMATEINTERESTS | IAB2 Key |
IABTCF_PublisherCustomPurposesConsents | IABTCF_PUBLISHERCUSTOMPURPOSESLEGITIMATEINTERESTS | IAB2 Key |
IABTCF_PublisherCustomPurposesLegitimateInterests | IABTCF_PUBLISHERCUSTOMPURPOSESCONSENTS | IAB2 Key |
IABTCF_PublisherRestrictions | OTIABTCFKeys.IABTCF_PUBLISHERRESTRICTIONS | IAB2 Key The key to be fetched will be IABTCF_PublisherRestrictions{ID} {ID} refers to purpose id. |
Sample Code Snippet
Context mContext = getApplicationContext();
SharedPreferences mPreferences = PreferenceManager.getDefaultSharedPreferences(mContext);
String consentString = mPreferences.getString("IABTCF_TCString", "");
int gdprApplies = mPreferences.getInt("IABTCF_gdprApplies", "");
//In case of using OneTrust's Constants above line can be written as below:
String consentString = mPreferences.getString(SharedPreferencesKeys.IABTCF_TCSTRING, "");
int gdprApplies = mPreferences.getInt(SharedPreferencesKeys.IABTCF_GDPRAPPLIES, "");
Get Vendor Consent
This method returns the details for a specific vendor, including consent value.
IAB Vendor
// example for getting IAB vendor full details
new OTPublishersHeadlessSDK(this).getVendorDetails(OTVendorListMode.IAB, "89");
Google Vendor
// example for getting Google vendor full details
new OTPublishersHeadlessSDK(this).getVendorDetails(OTVendorListMode.GOOGLE, "2572");
Get Vendor Count by Purpose
This method returns the vendor count for IAB purposes as required by IAB TCF 2.2. Applications will have to pass in the desired Purpose ID or Stack Number.
//Purposes
new OTPublishersHeadlessSDK(this).getVendorCount("IAB2V2_1")
new OTPublishersHeadlessSDK(this).getVendorCount("IAB2V2_2")
//Stacks
new OTPublishersHeadlessSDK(this).getVendorCount("V2STACK1")
new OTPublishersHeadlessSDK(this).getVendorCount("V2STACK42")
//Features
new OTPublishersHeadlessSDK(this).getVendorCount("IFE2V2_1")
new OTPublishersHeadlessSDK(this).getVendorCount("IFE2V2_2")
//Special Features
new OTPublishersHeadlessSDK(this).getVendorCount("ISF2V2_1")
new OTPublishersHeadlessSDK(this).getVendorCount("ISF2V2_1")
//Special Purposes
new OTPublishersHeadlessSDK(this).getVendorCount("ISP2V2_1")
new OTPublishersHeadlessSDK(this).getVendorCount("ISP2V2_2")
Values Returned
This method will return the Vendor Count as an Integer value. Here are the possible outcomes:
- Individual categories will have active IAB Vendors count returned
- Parent categories will have aggregated active IAB Vendors count returned
- Empty category IDs will return -1 as the Vendor Count
Get Total Vendor Count
This method allows you to return the total number of vendors your app is using. This can be useful in instances where you're building your own banner and need to include the vendor count as required by IAB.
JSONObject vendorCount = new OTPublishersHeadlessSDK(context).getVendorListData(OTVendorListMode.IAB);
vendorCount.length();
Update Vendor Consent
This method will allow your application to update consent value for vendors. Applications will have to pass a valid String value vendor ID along with a boolean state.
Calling this method will only update the local state of consent. To persist the updated values, applications will have to call 'saveConsentValueForCategory()' method explicitly.
`new OTPublishersHeadlessSDK(this).updateVendorConsent("51", true)`
Update Vendor Legitimate Interest
This method will allow your application to update legitimate interest value for Active IAB Vendor. Applications will have to pass a valid String value vendor ID along with a boolean state.
Calling this method will only update the local state of legitimate interest. To persist the updated values, applications will have to call 'saveConsentValueForCategory()' method explicitly.
If Legitimate Interests toggles are configured to be disabled for an application, then value will not get updated.
`new OTPublishersHeadlessSDK(this)..updateVendorLegitInterest("51", true)`
Update Purpose Legitimate Interest
This method will allow your application to update legitimate interest value for an IAB purpose. Applications will have to pass a valid String value group identifier along with a boolean state.
Calling this method will only update the local state of legitimate interest. To persist the updated values, applications will have to call 'saveConsentValueForCategory()' method explicitly.
If Legitimate Interests toggles are configured to be disabled for an application, then value will not get updated.
new OTPublishersHeadlessSDK(this).updatePurposeLegitInterest("IAB2V2_5", true)
Get Locally Saved Purpose Consent
This method will allow your application to retrieve the local consent value for an IAB purpose. Applications will have to pass a valid string value identifier for the purpose you're trying to query for.
new OTPublishersHeadlessSDK(this).getConsentStatusForGroupId("IAB2V2_1")
Returns the following Integer values:
- 1 = Consent Given.
- 0 = Consent Not Given.
- -1 = Invalid Group Id passed.
Get Locally Saved Purpose Legitimate Interest
This method will allow your application to retrieve the local legitimate interest value for an IAB purpose. Applications will have to pass a valid string value identifier for the purpose you're trying to query for.
new OTPublishersHeadlessSDK(this).getPurposeLegitInterestLocal("IAB2V2_3")
Returns the following Integer values:
- 1 = Consent Given.
- 0 = Consent Not Given.
- -1 = Invalid Group Id passed / Group Id does not have a Legitimate interest configured for it
Confirm My Choices CTA for the Vendor List
The Confirm My Choices CTA on the Vendor List will be hidden by default. When a user makes changes to vendor consents, they'll have to navigate back to the main Preference Center page to save and commit their choices. You can choose to show/hide the Confirm My Choices CTA on the Vendor List.
Setting the CTA
OTConfiguration otConfiguration = OTConfiguration.OTConfigurationBuilder.newInstance().setVendorListJourney(OTVendorListDismissMode.SHOW_CONFIRM_MY_CHOICE).build();
The method setVendorListjourney()
has two possible parameters:
Parameter | Description |
---|---|
showConfirmMyChoices | SDK UI should be dismissed when Confirm My Choices button is selected |
hideConfirmMyChoices | Hides the Confirm My Choices button in the Vendor List |
FAQ
Does the Mobile CMP support Global Scope?
No, as of the OneTrust 6.22 release, the Mobile CMP no longer supports Global Scope. All TC Strings will be encoded with isServiceSpecific: true going forward to remain compliant with IAB TCF’s latest policy.
Updated 5 months ago