TCF v2.0 Consent
This is an archived version of the documentation. Actual documentation for all platforms can be found here.
If you implemented a consent management platform (CMP) that complies with the IAB Transparency and Consent Framework (TCF) v2.0 for obtaining consent from the end user to transfer their personal data (user consent flow), Yandex Mobile Ads SDK supports sending TCF v2.0 values.
Yandex Mobile Ads SDK retrieves TCF v2.0 consent strings from SharedPreferences
using the following keys:
IABTCF_TCString | String | Full encoded TC string. |
IABTCF_gdprApplies | Number |
|
IABTCF_CmpSdkID | Number | Unsigned integer ID of the CMP SDK used. |
IABTCF_PurposeConsents | Binary string | “0” or “1” at position n, where n's indexing begins at 0. Indicates the consent status for purpose ID n+1. “0” corresponds to |
IABTCF_VendorConsents | Binary string | “0” or “1” at position n, where n's indexing begins at 0. Indicates the consent status for vendor ID n+1. “0” corresponds to |
IABTCF_TCString | String | Full encoded TC string. |
IABTCF_gdprApplies | Number |
|
IABTCF_CmpSdkID | Number | Unsigned integer ID of the CMP SDK used. |
IABTCF_PurposeConsents | Binary string | “0” or “1” at position n, where n's indexing begins at 0. Indicates the consent status for purpose ID n+1. “0” corresponds to |
IABTCF_VendorConsents | Binary string | “0” or “1” at position n, where n's indexing begins at 0. Indicates the consent status for vendor ID n+1. “0” corresponds to |
For a detailed description, see the IAB documentation.
Passing values to SharedPreferences
Make sure to set required key values before making ad requests. There are two ways to do this:
- Manually
-
Add the values for the keys from the table above to
SharedPreferences
. Example:Kotlinval sharedPref = activity?.getPreferences(Context.MODE_PRIVATE) ?: return with (sharedPref.edit()) { putInt("IABTCF_gdprApplies", 1) apply() }
JavaSharedPreferences sharedPref = getActivity().getPreferences(Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPref.edit(); editor.putInt("IABTCF_gdprApplies", newHighScore); editor.apply();
Note.For more information, see the documentation. The parameters depend on the country, user settings, and device.
- Via a CMP SDK
-
TUse pre-configured CMP SDKs. These SDKs automatically pass the necessary values to
SharedPreferences
so that Yandex Mobile SDK can use them.