Skip to content

Analytics

Consent Mode v2 with CookieYes and Google Tag Manager, step by step

If you use Google Analytics or Google Ads with CookieYes, Consent Mode v2 is what tells your tags what each visitor has accepted. Here's how to set it up in Tag Manager, step by step.

By 6 min read

Consent Mode v2 is how you tell Google what each visitor has accepted on your website. If you use Google Analytics 4 or Google Ads and you get visitors from Europe, you need it so that your tags behave according to the cookie banner, and so that features such as audiences and remarketing remain available.

In this article we set it up with CookieYes and Google Tag Manager, a very common combination on small business websites.

Consent Mode passes the state of several signals to Google tags. These are the four that matter for Analytics and Ads:

  • analytics_storage: whether analytics cookies can be used.
  • ad_storage: whether advertising cookies can be used.
  • ad_user_data: whether user data can be sent to Google for advertising purposes.
  • ad_personalization: whether the visit can be used for personalised ads (remarketing).

The last two are the ones the “v2” added. Each signal can be granted (granted) or denied (denied).

There are two ways to use it:

  • Basic mode: Google tags don’t load until the visitor accepts.
  • Advanced mode: tags always load, but if there’s no consent they don’t use cookies and only send pings that don’t identify the visitor.

In CookieYes, basic mode is turned on with the Support GCM option, and advanced mode also needs Allow Google tags to fire before consent. Choose the mode with whoever handles the legal side of your website.

Before you start

  1. Have your CookieYes account set up with your website and the banner configured.
  2. In CookieYes, go to Dashboard > Advanced Settings and turn on Support GCM.
  3. If you already had the CookieYes script in your website’s <head>, remove it: with the Tag Manager template, the banner loads from there. If you leave it, it will load twice.
  4. If your website is WordPress with the CookieYes plugin, CookieYes says the template isn’t compatible with the plugin. Disconnect and deactivate it first, or use their script method instead of the template.
  5. Copy your website key: in CookieYes, Advanced Settings > Get Installation Code > Install with Google Tag Manager > Copy Code.

Step by step in Google Tag Manager

  1. In your container, go to Tags > New.
  2. Click the tag configuration and search the Community Template Gallery for the CookieYes CMP template. Add it to your workspace.
  3. Paste your website key (Website Key) into its field.
  4. In the default consent settings, click Add Setting.
  5. Leave all non-essential categories denied (the “Disabled” option): analytics, advertisement and functional. The three advertising signals (ad_storage, ad_user_data and ad_personalization) depend on the CookieYes advertisement category.
  6. In the Regions field, enter where this state applies (we cover this in the next section) and click Add.
  7. As the trigger, choose Consent Initialization - All Pages. That way the default state is set before any other tag fires.
  8. Give it a clear name (for example, “CookieYes · Consent”) and save.

Some field names in the template may vary slightly depending on the version.

The default state and the region

The default state is the value of the signals before the visitor decides. In Europe, the safe choice is for it to be denied for everything that isn’t essential.

In the Regions field you can enter:

  • All: the same state for every visit, wherever it comes from. It’s the simplest option and the safest if you’re not sure which rules apply in each country.
  • Region codes (ISO 3166-2) separated by commas, for example ES or FR, if you want a different state depending on the country. You can add several settings with Add Setting.

If your website belongs to a small business working in Spain, All with everything denied is usually the simplest choice. Go over the decision with whoever handles the legal side.

Check your other tags

With the template installed, the banner and the signals already work. Now you need to check that your tags respect them:

  1. Go to Admin > Container Settings and turn on Enable consent overview. From the tag list you’ll be able to see at a glance which tags have consent set up and which don’t.
  2. Google tags (GA4, Google Ads) have built-in consent checks: they read the signals on their own.
  3. For the rest (the Meta pixel, Hotjar, TikTok…), open each tag and, under Advanced Settings > Consent Settings, select Require additional consent for tag to fire and choose the matching signal (for example, ad_storage for an advertising pixel).

How to check it works

Don’t assume it works without testing it. Here’s how:

  1. In Tag Manager, click Preview. Tag Assistant opens with your website connected.
  2. Without touching the banner, look for the first Consent event in the summary on the left. In the Consent tab, the On-page Default column should show all four signals as denied.
  3. In the tags tab, check that the tags that need consent haven’t fired, or have fired without cookies.
  4. Now accept on the banner. In the latest Consent event, the On-page Update column should show the signals as granted.
  5. Repeat the test in a new window, this time rejecting: the signals should stay denied.

CookieYes also has Advanced Settings > Check GCM status > Check Now. If everything is fine, it will say it doesn’t detect any errors.

If you then want to check that visits are reaching Analytics properly, our article on how to measure ChatGPT traffic in GA4 shows you where to look at the acquisition channels.

Common mistakes

  • Tags that fire before consent. This happens when the GA4 or pixel code is pasted directly into the website as well as in Tag Manager. Search the source code and keep each tag in one place only.
  • A default state that arrives too late. If the template doesn’t use the consent initialisation trigger, some tag may read or write cookies before it. Tag Assistant flags this as an error.
  • A banner with no reject button. The cookie guide from the AEPD (Spanish Data Protection Agency), updated in 2023, requires reject to be on the first layer of the banner, at the same level as accept. Check the banner design in CookieYes: a small grey link isn’t enough.
  • Everything granted by default. Some people leave it like that “so as not to lose data”. That’s exactly what consent is meant to prevent.
  • Duplicate banner. The script in the <head> and the template at the same time, or the WordPress plugin and the template: the banner appears twice or the signals contradict each other.
  • Third-party tags without additional consent. The Meta pixel doesn’t understand Consent Mode on its own: you need to set it up in Tag Manager.

Setting up consent properly is the foundation of any reliable measurement. If you’d rather we reviewed it for you, take a look at our measurement setup service.

Frequently asked questions

Can I use the CookieYes template if my website is WordPress with their plugin?

Not at the same time. CookieYes says the Tag Manager template isn't compatible with its WordPress plugin: you need to disconnect and deactivate the plugin, or use their script method instead.

What's the difference between basic and advanced mode?

In basic mode, Google tags don't load until there's consent. In advanced mode they always load, but without cookies if the visitor doesn't accept, and they send pings that don't identify the visitor.

Does Consent Mode v2 replace the cookie banner?

No. The banner collects the visitor's choice and Consent Mode passes it on to Google tags. You need both, plus an up-to-date cookie policy.

Do non-Google tags respect Consent Mode on their own?

Not always. Google tags have built-in checks. For others, such as the Meta pixel, turn on additional consent in Tag Manager or use triggers that depend on it.

Sources

  1. CookieYes: Implementing Google Consent Mode Using CookieYes (opens in a new window)
  2. Tag Manager Help: Tag Manager consent mode support (opens in a new window)
  3. Google for Developers: Set up consent mode on websites (opens in a new window)
  4. Google for Developers: Troubleshoot consent mode with Tag Assistant (opens in a new window)
  5. AEPD: actualización de la Guía sobre el uso de cookies (in Spanish) (opens in a new window)

Facts checked on . Written and reviewed by Albert Gómez Vives. How we write these guides.

More articles

Get your proposal

Tell us what you need and we'll send you a no-obligation quote.

Let's talk