Google Consent Mode v2 – implementation example

Beautiful Cookie Banner supports Google Consent Mode v2. This article gives you a brief intro in consent mode and how to configure your cookie banner.

Why is consent mode v2 important?

You get a much better tracking accuracy as the traffic and conversion you are missing due to user opt-out will be modelled.

From March on Google Tracking products like Google Ads tracking, Google Analytics 4 and Google Floodlights need consent mode to work properly.

What options do you have?

You can set up the Basic implementation or the Advanced version of it.


You just push the consent information additionally to the dataLayer. That’s it. Official docs:

If you have already a working set up, you just set up consent mode additionally. Then additional Information, which is required by google, is added to the google tracking requests.

If you start from scratch you first make sure, that the tags fire when there is consent. You can do this with the “blocking feature” of the premium plugin or with Google Tag Manager (recommended) see here for more info. If that is set up, just add the consent mode signals to get the consent mode infos additionally.


You push the consent information to the dataLayer, same as Basic. Additionally you fire all Google Tags always. Independent from the user’s consent. You rely here on the Google tags to handle the data in a GDPR friendly way.

This version is quite controversial from a data privacy point of view. This is why I focus in this article on how to implement the basic version.

Consent mode implementation example

For Google Tags the important parameters are:

  • analytics_storage
  • ad_storage
  • ad_user_data (new in v2)
  • ad_personalization (new in v2)

Lets configure it for this example banner:

Let’s assume all your Google tracking tags fire on “Marketing” consent and you want to allow personalization.

This would be the configuration of the beautiful cookie banner then:

That’s it. Your tags still fire how you have configured them. They just have some additional parameters added to the request.

Disclaimer: This article does not contain any legal advice of any kind. It only describes the technical implementation.

For more inofficial background information of consent mode and how to debug and test it, see this german blog post:

And here is a good article in english:

Unfortunately it is in german, but the build in translation feature of the major browser can help with that.

Test consent mode

If you execute this command in your browser console you get some insights on the current consent mode settings: