This page is for developers who maintain a consent banner and need to integrate with the TCF framework.
The IAB Transparency Consent Framework (TCF) is an open-standard technical framework that enables websites, advertisers, and ad agencies to obtain, record, and update consumer consent for web pages. TCF parameters are valid for Google Ads cookies written by Google Ads or Google Analytics. To control Google Analytics cookies, integrate with consent mode.
Implementation
You can enable TCF support by setting the following window property to
true
:
window['gtag_enable_tcf_support'] = true
This window
property must be set before any calls to gtag()
are made, and
this property must be set on each page for which you want to enable TCF support,
including those loaded via iframe. If the property is not set or set to false
,
TCF support will not be activated.
Purposes
A "Purpose" in the TCF context is a defined intent for processing data. Google Analytics tags implemented via Google Tag Manager or gtag.js with TCF support enabled will handle requests that contain the consent string in the following ways:
Purpose | Description | Impact to Google Analytics when Purpose is denied |
---|---|---|
1 | Store and/or access information on a device | Advertising-related cookies will not be created or used by Google Analytics. Google signals features such as remarketing, demographics, and interests reports will not accumulate data for unconsented users. |
3 | Create a personalised ads profile | Hits to Google Analytics will be marked with an npa=1 parameter. Events marked with npa=1 are not eligible for ads personalization, and are not used for remarketing audience evaluation. Users already added to audience lists are unaffected. |
4 | Select personalized ads |
Hits to Google Analytics will be marked with an npa=1 parameter. Same as Purpose 3. |
7 | Measure ad performance | allow_google_signals will be set to false. Advertising-related cookies will not be used by Google Analytics. Google signals features such as remarketing, demographics, and interests reports will not accumulate data for unconsented users. |
9 | Apply market research to generate audience insights | allow_google_signals will be set to false. Same as Purpose 7. |
10 | Develop and improve products | allow_google_signals will be set to false. Same as Purpose 7. |
Troubleshooting error messages
If the CMP doesn't respond within 500 milliseconds or you see "error", "stub", or "loading" status, the tag will proceed in a restricted mode. To fix that:
If you are manually invoking the function to fire a conversion tag:
Make sure the response togetTCData TCData.eventStatus = 'tcloaded'
OR'cmpuishown' + 'useractioncomplete'
is sent within 500 milliseconds. These indicate the CMP is ready to provide the user with a choice regarding consent.If you are not manually invoking the function to submit a conversion tag:
Implement support forgetTCData and return TCData.eventStatus = 'tcloaded'
OR'cmpuishown' + 'useractioncomplete'
to indicate the user consent is ready for use through the API within 500 milliseconds.
Next steps
If you plan to provide your customers with a tag they can use in Google Tag Manager, create a tag template for your banner.