Skip to main content
All CollectionsGoogle consent mode v2
Use the IAB Transparency & Consent Framework (IAB TCF 2.2) with Google consent mode v2
Use the IAB Transparency & Consent Framework (IAB TCF 2.2) with Google consent mode v2

Learn how to use the IAB Transparency & Consent Framework template (IAB TCF 2.2) with Google consent mode v2.

Updated over a month ago

The Interactive Advertising Bureau Transparency and Consent Framework (IAB TCF) is an alternative method for obtaining and tracking user consent. It standardizes the way websites and advertisers can collect, manage, and communicate user consent for data processing. You can use Google consent mode v2 in addition to Transparency and Consent Framework 2.2 (TCF).

In this article, we’ll explain how to use the IAB Transparency & Consent Framework template (IAB TCF 2.2) with Google consent mode v2.

Before you start

Here are a few things to know before you start:

  • The IAB Consent & Transparency Framework (TCF) is designed for companies involved in digital advertising and data processing. It primarily helps:

    1. Publishers Websites and apps that display ads and collect user data.

    2. Advertisers Businesses that use targeted ads to reach audiences.

    3. AdTech vendors – Companies that provide technology for serving and managing ads (e.g., ad networks, data management platforms).

  • If you use the IAB Transparency & Consent Framework and send the correct consent string to your vendors, you must use a consent popup that meets IAB's approved criteria.

    The IAB has strict design requirements for how the consent popup should look before it meets the framework standards. To ensure our clients follow these requirements, Cookie Information has created a consent banner template that has been approved by the IAB.

  • IAB requires you to install a stub before the main TCF API starts. We install it for you automatically once you place Cookie Information main installation code on your page.

  • You can use Google consent mode v2 in addition to TCF 2.2. A TCData update (TCData.enableAdvertiserConsentMode) allows Google to extract the necessary data from the TC string. The settings for ad storage, ad personalization, and ad user data will be determined by the consent information provided by the user.

  • There are two different Google consent modes: basic and advanced. You can implement both in Cookie Information. The basic consent mode doesn’t allow you to collect any user data, not even consent status, until the user agrees. In the advanced consent mode, Google tags are loaded before the consent popup displays to users. Google collects cookieless data without personal identifiers.


    Whatever the implementation method of Google consent mode v2 you use, you must have a link to Google’s business data responsibility site in your consent template. That way, users can easily reach that information.

  • Local laws and guidelines may differ from IAB requirements regarding the appearance and text of your consent popup. The instructions in this article might have to be adjusted for your specific needs.

Set up the TCF with basic Google consent mode v2

To Implement the TCF with basic Google consent mode v2, follow these steps:

  1. Log into Cookie Information.

  2. Find the consent solution you want to set up the consent template for.

  3. In Pop-up appearance, go to Change template.

  4. From the drop-down list, choose the template called IAB TCF v2.2 + Google Consent Mode v2.

    IAB TCF v2.2 + Google Consent Mode v2 overlay in Cookie Information

5. Click Save and publish.

Note: The IAB TCF popup design now applies to the domains in the consent solution you’re editing. This implementation will not affect other consent solutions within your account.

You can view the IAB TCF 2.2 template in our template showcase or see the image of the template below.

IAB TCF 2.2 consent banner template in Cookie Information

6. Add consent mode attribute: data-gcm-version="2.0" to the main installation code.

7. Add to the script the TCF attributes: data-tcf-v2-enabled="true", data-tcf-version="2.2".

The description of each data attribute in the TCF script:
data-gcm-version="2.0" enables GCM v2

data-tcf-version="2.2" sets TCF version to 2.2

Note: To ensure that you send the correct consent string via TCF, you need to exchange the standard popup script for the one below.

The correct version of the consent popup script including the two TCF attributes, will look like this:

<script id="CookieConsent" type="text/javascript" data-culture="EN" src="https://policy.app.cookieinformation.com/uc.js" data-gcm-version="2.0" data-tcf-v2-enabled="true" data-tcf-version="2.2"/>

The description of each data attribute in the TCF script:

data-culture="en" → Controls the languages

data-tcf-v2-enabled="true" →Enables TCF

8. Place the main installation code inside the <head> tag of your website’s source code.

Set up the TCF with an advanced Google consent mode v2 (optional)

Add the following code snippet to your source code of the website before the main installation code.

<script>
window.dataLayer = window.dataLayer || [];
function gtag(){ dataLayer.push(arguments); }
// Set default consent to 'denied' as a placeholder
// Determine actual values based on customer's own requirements
gtag('consent', 'default', {
'ad_storage': 'denied',
'ad_user_data': 'denied',
'ad_personalization': 'denied',
'analytics_storage': 'denied',
'wait_for_update': 500
});
gtag('set', 'ads_data_redaction', true);
gtag('set', 'url_passthrough', true);
</script>

The correct implementation for the advanced mode should look like this:

<script>
window.dataLayer = window.dataLayer || [];
function gtag(){ dataLayer.push(arguments); }
// Set default consent to 'denied' as a placeholder
// Determine actual values based on customer's own requirements
gtag('consent', 'default', {
'ad_storage': 'denied',
'ad_user_data': 'denied',
'ad_personalization': 'denied',
'analytics_storage': 'denied',
'wait_for_update': 500
});
gtag('set', 'ads_data_redaction', true);
gtag('set', 'url_passthrough', true);
</script>
<script id="CookieConsent" type="text/javascript" data-culture="EN" src="https://policy.app.cookieinformation.com/uc.js" data-gcm-version="2.0" data-tcf-v2-enabled="true" data-tcf-version="2.2">

Note: Make sure to change the data-culture attribute to the specific language that you use for your popup. To find all the language codes and additional information, see this guide.

Related articles:

Did this answer your question?