Do you need to know how to check if Google Consent Mode v2 is implemented correctly? Consent Mode offers a straightforward and dependable method to prevent the setting of cookies by Google scripts when using Google Tag Manager or gtag. Although the setup process is uncomplicated, verifying the accuracy of the implementation and ensuring everything is functioning correctly can be challenging.

To determine if Google Consent Mode is properly implemented, you can check four things:

  1. The Consent tab of the Preview in Google Tag Manager.
  2. The Consent Mode default settings registered in Google Tag Manager.
  3. Values registered in the dataLayer.
  4. Google Analytics 4

We will go through these 4 ways how to check if Google Consent Mode is implemented correctly and is working as intended.

Need help? Link your Cookiebot account to CookieInfo for a free check of your Consent Mode setup. No account yet? Then create a free trial period.

We assume you’ve added the Consent Mode script before the Google Tag Manager script as instructed in our guide.

It’s important to note that only the following tags in Google Tag Manager support Advanced Consent Mode:

1. Check the preview in Google Tag Manager

You can inspect the preview in Google Tag Manager to confirm that Consent is enabled. If you want to check consent mode V2 check below.

Start the preview and take the following steps:

  1. Select “Consent”
  2. Select the “Consent” tab
  3. Ensure that the “On-page Defaults” are set and that they include the two new parameters; ad_personalization and ad_user_data.
Google Consent Mode v2 check - CookieInfo

When a page loads with prior consent, the settings for consent mode must be accurately recorded within Google Tag Manager.

Should you deploy Cookiebot via the Cookiebot CMP tag, the default configurations will not be transferred to the dataLayer. Instead, they are stored within Google Tag Manager itself, meaning a simple inspection of the dataLayer is insufficient for those who have implemented Cookiebot CMP using our template tag in Google Tag Manager.

Below is a script that can be executed in your browser’s console (usually accessible by hitting F12 in most browsers), enabling you to verify the consent settings recorded in Google Tag Manager:

(() => {
  l = s => s == undefined ? "" : s ? "granted" : "denied";
  c = s => s == "granted" ? "color: #0C0": "color: #C00";
  if (!window["google_tag_data"]) {
    console.warn("No Consent Mode data found");
    return;
  }
  var g = "ics" in google_tag_data ? google_tag_data.ics.entries : null, 
      i = "",
      t = "%c" + "Consent Mode settings:", 
      u = "";
  console.log(t, "font-size: 1rem");
  for (var a in g) {
    i = l(g[a]['default']);
    u = l(g[a]['update']);
    if (i == "" && u == "") continue;
    t = ("\t" + a + ":" +
      (i != "" ? "\n\t\tDefault: %c" + i : "%c")
      + "%c" +
      (u != "" ? "\n\t\tUpdate: %c" + u : "%c"));
    console.log(t, i != "" ? c(i) : "",
    "", u != "" ? c(u) : "", "");
  }
  if (i == "") console.log("No default Consent settings found");
})()

The output should look similar to this:

Google Consent Mode check in Chrome developer mode - CookieInfo
Google Consent Mode check in developer mode – prior consent
Consent Mode check in developer mode – after consent

How to: Run above script 2 times in a fresh browser (incognito) window. First time, load the website, do not give consent on cookies in your cookie banner. Open console and paste the script, hit enter (see your results). All consent mode settings should be listed as denied.

Now accept cookies and past the script again in your console and see its outcome.

If your consent mode settings are not correct, you will want to check our article on implementing Cookiebot Google Consent Mode v2 here.

Checking the contents of the dataLayer can be done by simply executing the command “dataLayer" in the console, or using this script to make it a bit easier to read:

(function(w, d, t) {
  for (i of w[d])
    t += JSON.stringify(i).replaceAll(/\"\d{1,}\":/g, "") + "\n";
  console.log(t);
})(window, "dataLayer", "")

The output should look similar to this:

{"consent","default",{"ad_storage":"denied","analytics_storage":"denied","wait_for_update":500}}
{"set","ads_data_redaction",true}
{"gtm.start":1608107133821,"event":"gtm.js","gtm.uniqueEventId":2}
{"event":"gtm.dom","gtm.uniqueEventId":3}
{"event":"gtm.load","gtm.uniqueEventId":5}

After consent has been given (in the cookie banner) for all types of cookies, the dataLayer will contain both the initial, and updated Consent Mode settings:

{"consent","default",{"ad_storage":"denied","analytics_storage":"denied","wait_for_update":500}}
{"set","ads_data_redaction",true}
{"gtm.start":1608106162221,"event":"gtm.js","gtm.uniqueEventId":2}
{"event":"cookie_consent_preferences","gtm.uniqueEventId":3}
{"event":"cookie_consent_statistics","gtm.uniqueEventId":4}
{"event":"cookie_consent_marketing","gtm.uniqueEventId":5}
{"gtm.start":1608106162636,"event":"gtm.js","gtm.uniqueEventId":7}
{"event":"gtm.dom","gtm.uniqueEventId":9}
{"event":"gtm.load","gtm.uniqueEventId":11}
{"set","developer_id.dMWZhNz",true}
{"consent","update",{"ad_storage":"granted","analytics_storage":"granted"}}
{"set","ads_data_redaction",false}

Check GA4 if you are sharing valid consent signals with Google. Navigate: GA4>Admin>Data streams>Web stream details>Consent settings

Need help?

Check the Google website for more information about Tag manager assistant.

Need help or want more information on Google Consent Mode V2? Contact us or visit our dedicated Consent Mode Page.

14 day free trial Cookiebot

Cookie scanner, cookie banner, cookie declaration and cookie consent in one solution.

  • Use cookies on your website compliant with GDPR, ePrivacy and cookie legislation
  • Cookie management completely automated
  • Cookie banner based on your corporate identity
  • Automatic composed cookie declaration, always up to date

The Cookiebot solution runs on 2 million websites, manages 6.3 billion monthly User Consents and supports 47+ languages.