How to Implement Consent Mode v2 and Not Die Trying

The European digital market regulation legislation came into effect this month, triggering a domino effect that has impacted both national regulations and the way large digital platforms manage and use user data.

In the case of Google, its response has been the launch of Consent Mode v2, which is causing a real earthquake in the functioning of Analytics and Google Ads. In this blog post, we explain the technical difficulties we have encountered in implementing Consent Mode v2. If you want more details about the new regulatory framework and the consequences of not implementing Google’s consent mode, you can consult this other blog post.

To implement Consent Mode v2 and prevent Google’s fury from falling on your campaigns, you have three reasonably practical and affordable options: (1) follow the steps indicated by your CMP — possibly installing Google Tag Manager (GTM) template developed by the consent management platform itself –; (2) configure it manually with the GTM template developed by Simo Ahava (if you haven’t heard of him, let us introduce you: Simo is a god in the world of GTM and Analytics. If he played basketball, he would be called Michael Jordan); or (3) contact your Google account manager, so that they can put you in contact with someone from Google’s Technical Solutions Team who can help you configure Consent Mode via GTM. Each of these three alternatives has its advantages and disadvantages.

Custom Templates by Your CMP: The Ideal Solution (Sometimes)

If on your website you have installed the consent management platform (CMP) Cookiebot, don’t waste any more time on this blog and follow the steps indicated in this excellent webinar by Iñaki Gorostiza.

Without intending to be exhaustive by any means, for the CMP Cookie Information, this video by Lars Friis might be useful; for Termly, this other one from Loves Data, and for Complianz, this link. CookieYes has also updated its documentation this week. However, not all CMPs have adapted their documentation for Consent Mode v2, nor have they developed a GTM template that integrates the CMP correctly with Consent Mode v2. And generally, technical support is only accessible to premium versions. So, depending on your setup, it might not be a suitable solution for you. Moreover, if it is not a CMP certified by Google, only limited ads will be eligible to show in traffic from the European Economic Area and the United Kingdom (Source).

Manual Configuration: In Simo We Trust

The second option (the manual configuration with Simo Ahava’s template) is free, can be adapted to any CMP, and we can attest that it works well, but it requires certain technical knowledge. Simo does not write for everyone, but for developers. If you were already using his previous template for Consent Mode v1, the new one is an adaptation to accommodate ad_user_data and ad_personalization, the two new parameters added by Google in 2024. And if you’re starting from scratch, this video by Leon Korteweg might help.

Faktica parametros modo consentimimento v2

Consent mode parameters required for personalized advertising starting March 2024

Leveraging Google Help (or How to Make a Faust)

We have tested the third option (the Google help) with four of our client accounts, with very mixed results. In each account, we were put in contact with a different person from Google’s Technical Solutions Team, and the first thing that strikingly stands out is the disparity of support depending on who you end up with. We’re talking about a problem that affects tens of millions of its users, with significant legal and operational repercussions, which can sink the results of campaigns if not managed well, and we expected a well-crafted response from Google, developed centrally and tested before being passed on to users in all the affected countries. This is not the case. Each member of Google’s technical team applied their own recipe, and some work better than others.

However, there are some common points. In 2 of the cases, the Google Technical Solutions Team passed us a JSON with a multitude of variables, triggers, tags, and templates that they ask you to install on your website without much explanation.

Content of the JSON shared by Google (Google Tag Manager (GTM) elements for the Spanish version)

Fakticas JSON consent mode v2 Google

Templates and Tags from Google's JSON

One of the tags is the Simo Ahava’s GTM template, pre-configured and with several additions. Simo is very much Simo, but it’s really surprising that Google hasn’t developed its own template. All the following images are examples of the GTM configuration in Spanish.

Faktica Consent Mode v2 GTM tag

Also included in the pack was a template from OneTrust — a CMP we do not use on any of the accounts, and whose template we never used at any point, but that the Google technical solutions team includes in the JSON for some reason that escapes me and which they have not been able to explain.

Faktica Consent Mode v2 GTM tag 2

Interestingly, when we received the JSON, Google itself did not recognize OneTrust as a registered CMP.

Faktica CMP Partner Program

Problematic Triggers in Google's JSON

Google’s JSON contains 10 triggers, among which these six are included:
Fakticas JSON consent mode v2 Google activadores
The thing is, the last three weren’t connected to anything; either you change the configuration of the tags and triggers to make use of them, or we recommend removing them, so as not to leave them in your container like space junk floating in space. The first three were indeed connected to their respective tag, but they only worked for specific texts, which require adaptation, more or less complex depending on your CMP, and for which you may receive little or no support, depending on the level of knowledge and involvement of the person assisting you.

Variables to pay attention to

Among all the material in the JSON there is the variable “regiones”, with the following values:
Faktica Consent Mode v2 GTM tag regiones

You need to know what these acronyms mean, to verify in which countries this configuration will work. After all, the responsibility for your cookie banner to work in compliance with the current legislation in each country is yours, not Google’s. We asked two Google support staff about these values and they couldn’t answer us. Fortunately, Simo Ahava’s template does explain it, and kindly adds this link to Wikipedia where you can identify the ISO 3166-2 code for each country.

Among many other variables, the JSON also includes these two custom Javascript variables: Accept Analytics and Accept Ads.

Faktica Consent Mode v2 GTM tag 3

In our case, the Google team did not use them. The thing is, they are necessary for tracking configuration preferences, but with us, they were satisfied with configuring something that worked in a binary mode: either approve all cookies or reject all cookies. Once these two options were tested, they sent us emails like this:

Faktica Consent Mode v2 Enhorabuena

The problem is that if you only approve analytics cookies but not marketing cookies, or vice versa, what they have set up for you won’t work. What you really need to do here is update the Accept Analytics and Accept Ads variables, changing line 2 to the switch identifier in your banner to enable or disable analytics and marketing cookies respectively. For example, in Complianz they would be #cmplz-statistics-optin and #cmplz-marketing-optin.

Faktica Consent Mode v2 complianz

Code error in the LocalStorage

The JSON supplied by Google includes all of these variables for the data layer and custom JS:
Faktica Consent Mode v2 errores
All the custom JS variables included in the JSON with the “localstorage” suffix follow a similar structure:
Faktica Consent Mode v2 parametros GMT

localStorage is a web storage that allows websites and applications to store data persistently in the user’s browser. Data stored in localStorage persists even after the browser is closed and reopened.

By storing the user’s preference in localStorage, the site can remember and respect the user’s choice about storing and handling ads without needing to ask them each time they visit the site.

It’s important to mention that using localStorage to manage user consents or preferences must comply with applicable privacy regulations, such as GDPR in Europe, which requires websites to obtain explicit user consent before using cookies or local storage for tracking or personalized advertising. Therefore, if Google provides you with code that you have to inject into your website and that could potentially violate your country’s legislation, ask whoever gave you the code what these variables are, what they do, and what they are for.

In our case, they couldn’t tell us, and it’s because, as they were defined, they didn’t work. And they didn’t work because the consent revocation tag included in the JSON contains several spelling mistakes (!!)! If you look at the image below, line 5 has “personalization” misspelled, so it can’t read the corresponding variable. But also, the final part “_storage” is redundant in lines 5 and 6, as you can see in line 2 of the two variables in the boxes above. By correcting the typo “persoanlization” and removing “_storage“, suddenly everything starts working.

Faktica Consent Mode v2 revoke GMT

The light at the end of the tunnel

As you can see, Google’s support for Consent Mode v2 can be, as of today and depending on who assists you, quite limited. The code that some of the technical support staff provide is untested code, with text errors, and it’s not adapted to your CMP. But the points above are the most important ones that require your attention. By correcting these points, you’ll be able to have Consent Mode v2 configured correctly. Remember that it’s in your own interest, because even though Google provided you with the code, the legal responsibility for what you inject into your website is yours.

How to know if you have Consent Mode configured correctly?

Regardless of whether you’ve configured it with Google’s help, with a template from your CMP, or on your own, you should test all possible combinations to avoid surprises.

You can use the NETWORK tab of your browser’s developer tools. For the original version of Consent Mode, if you’re looking at network requests, the parameter you’re looking for is called gcs, and its possible values are:

G100 No consent has been granted.

G110 Google Ads has consent, Google Analytics does not.

G101 Google Analytics has consent, Google Ads does not.

G111 Both Google Ads and Google Analytics have consent.

Faktica Consent Mode bien instalado

But the gcs parameter is only for ad_storage and analytics_storage. For the new signals and for Consent Mode V2 in general, there is an additional URL parameter, gcd, whose interpretation Simo explains in detail here.

You can also use Google’s Tag Assistant, which is easier to interpret.

Faktica Consent Mode v2 GMT Consent state
Faktica Consent Mode v2 GMT Consent state 2

Our advice is to verify the consent panel of the Tag Assistant after each of the following steps:

  1. Enter the website
  2. Accept Cookies
  3. Leave the website and re-enter to check if it remembers the last selection.
  4. Clear cookies and cache.
  5. Leave and re-enter the website. Reject cookies.
  6. Leave and re-enter to check if it remembers the last selection.
  7. Accept only analytics cookies. Reject marketing cookies.
  8. Leave and re-enter to check if it remembers the last selection.
  9. Clear cookies and cache.
  10. Accept only marketing cookies. Reject analytics cookies.
  11. Leave and re-enter to check if it remembers the last selection.
  12. Clear cookies and cache.
  13. Leave and re-enter. Click configure cookies > accept marketing and analytics cookies > save preferences.

If all types of consent change when they’re supposed to and persist after leaving the page, CONGRATULATIONS: you have survived Consent Mode v2. Now your remarketing campaigns should recover traffic, and the performance of those using Smart Bidding should recover (at least partially). However, conversion tracking will be significantly affected because many more users will now reject cookies, but that’s another topic we’ll leave for another time, as this blog post is already quite long.

If something isn’t quite working, you need help, or you have questions about advanced configuration, you can always contact us. We’ll be happy to assist you.

MOST RECENT ARTICLES

Scroll to Top

Can We Help You?

Included by Google in the Top 3% of Spanish PPC agencies
Neotec-CDTI-logo
Subsidized by the CDTI in 2021-2023.

FÁKTICA ANALYTICS

Calle Núñez de Balboa, 35A

28001 Madrid

Spain

 

DATALYTICS

4 Portland Ct

St. Louis, MO 63108

USA

Contact: info@faktica.com
Can We Help You?

Ask Us for a No-Obligation Quote

Request a Traffic, Cost, and Potential Conversions Estimate

Ask About Our Pay-for-Performance Pricing

Get a Free Opportunities Analysis

Can We Help You?

Don’t hesitate to reach out to us