Skip to main content

How to implement Teads Pixel on Websites with Google Consent Mode v2

This article is a guide to implementing the Teads Pixel on websites using Google Consent Mode v2.

Updated this week

This guide is intended for advertisers that are looking to implement the Teads Pixel on their website, while using a consent management solution that is compatible with Google Consent Mode v2.

Google Consent Mode v2 allows tracking scripts, also referred to as tags, to behave based on user choices around four key parameters:

  • ad_storage: Controls the storage of user’s personal data for advertising.

  • analytics_storage: Manages the storage of data for analytics.

  • ad_user_data: Pertains to the collection and usage of user data for advertising.

  • ad_personalization: Allows the use of user data to personalize ads.

Consent Mode does not replace the requirement for a Consent Management Platform (CMP) or a cookie consent banner. It will operate alongside these tools, to ensure all tags loaded on the website operate according to user privacy preferences; allowing advertisers to comply with regulations like EU GDPR while maintaining essential analytical data.

Setting up Consent Mode

There are two ways to enable Google Consent Mode v2 on a website:

Option 1 — Via Google tag (gtag.js) directly

  1. Add the Google tag to your pages (typically in <head>). Refer to the official Google documentation for implementation details.

  2. Immediately after gtag is defined, set the default consent to denied (before any other tags are fired).

    <script async src="https://www.googletagmanager.com/gtag/js?id=AW-XXXXXXX"></script>
    <script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){ dataLayer.push(arguments); }

    // Default: nothing allowed until user accepts
    gtag('consent', 'default', {
    ad_storage: 'denied',
    analytics_storage: 'denied',
    ad_user_data: 'denied',
    ad_personalization: 'denied'
    });

    gtag('js', new Date());
    gtag('config', 'AW-XXXXXXX');
    </script>

Option 2 — Google Tag Manager (GTM)

  1. Create custom HTML tag (or use your GA4 or Google Ads config tag) to assign the default consent values to denied.

    <script async src="https://www.googletagmanager.com/gtag/js?id=AW-XXXXXXX"></script>
    <script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){ dataLayer.push(arguments); }

    // Default: nothing is allowed until the user accepts
    gtag('consent', 'default', {
    ad_storage: 'denied',
    analytics_storage: 'denied',
    ad_user_data: 'denied',
    ad_personalization: 'denied'
    });

    gtag('js', new Date());
    gtag('config', 'AW-XXXXXXX');
    </script>

  2. Use Consent Initialization – All Pages as the trigger.

  3. Ensure the tag is the first one to fire on your website. Other marketing/analytics tags must not fire before this Consent Initialization step.

    For more information about Google Consent Mode v2, refer to this Google article.

Consent Mode v2 and the Teads Pixel

Once Consent Mode v2 has been implemented on a website, Teads Pixel is able to read the consent signal from the page. No additional tools are needed:

  1. Set the default consent state according to your local regulations. This value must be set to denied as default for advertisers operating in countries regulated by GDPR or similar privacy laws.

  2. Place the Teads Pixel snippet as provided (directly on the header of your website or via GTM), ensuring that the tag is placed after the default consent state tag from step 1.

  3. After the user selects their preference in your CMP or cookie banner, fire a consent status update to reflect the user’s choice.

    1. User consents to cookies:

      gtag('consent', 'update', {
      ad_storage: 'granted',
      ad_user_data: 'granted',
      // optional but often useful:
      analytics_storage: 'granted',
      ad_personalization: 'granted'
      });
    2. User does not consent:

      gtag('consent', 'update', {
      ad_storage: 'denied',
      ad_user_data: 'denied',
      analytics_storage: 'denied',
      ad_personalization: 'denied'
      });
  4. The Teads Pixel will read the page’s consent state signals and behave according to the user's selection. For advertisers operating in regions covered by GDPR or similar privacy laws, the Teads Pixel will check the Consent Mode internal state at runtime (window.google_tag_data?.ics?.entries), and validate that the ad_storage and ad_user_data keys have been updated to ‘granted’:

    • ad_storage.update === true

    • ad_user_data.update === true

    These update event flags indicate that the consent was granted as a result of user action, and not the default value. The Teads Pixel will not log the user's activity if this explicit consent signal is missing.

Validating an implementation

To confirm if Google Consent Mode v2 and Teads Pixel have been implemented correctly, follow the steps below:

  1. Open the website on your browser.

  2. Before clicking on the cookie banner to accept cookies, open the browser's Developer Tools, and select Console.

  3. Run the following command: window.google_tag_data?.ics?.entries

  4. The consent values displayed in the Console must all be set to "denied" as default for advertisers operating in regions covered by GDPR or similar regulations.

  5. Click the banner on the page to accept the use of cookies.

  6. Run the window.google_tag_data?.ics?.entries command again.

  7. If successfully implemented, the expected values will be displayed in the Console as:

    • ad_storage.update === true

    • ad_user_data.update === true

If you are not using Google Consent Mode v2, Teads also supports IAB TCF v2.2 (with the required vendors/purposes), as well as popular CMP solutions such as Didomi, OneTrust, Cookiebot, and Usercentrics.

Did this answer your question?