Usercentrics - PUBLIC

Checking your Google Consent Mode v2 implementation

  1. We assume you've added the Google Consent Mode script before the Google Tag Manager script as instructed in our tech doc or youā€™re using the Usercentrics CMP GTM template.

  2. We also assume youā€™ve activated Google Consent Mode in the Admin Interface of your CMP Configuration or completed Step 2 of the tech doc and deactivated Google Consent Mode in the Admin Interface.

Some ways to check & test your GCM implementation:

Checking the preview in Google Tag Manager

You can inspect the preview to confirm that Google Consent Mode v2 is enabled.

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.

Screenshot 2024-03-07 at 12.00.48.png

For a more thorough check that also includes checking the GCM storage type consent state updates, please refer to Googleā€™s own detailed documentation on verifying your GCM implementation with Tag Assistant.

Checking the Google Consent Mode settings

When a page loads prior consent, the Consent Mode settings should be correctly registered in Google Tag Manager.

If you've implemented Usercentrics using the Usercentrics CMP template for GTM, you donā€™t need to add the default values for the Consent Mode storage types as theyā€™re present in the UC template. Exception: If youā€™re using Google tags outside the GTM as well.

If you arenā€™t using our GTM template and/or using some Google tags directly in your code, please make the required adjustment in your siteā€™s source code as documented.

Screenshot 2024-03-07 at 12.15.34.png

Checking the dataLayer

Checking the contents of the dataLayer can be done by simply executing the command dataLayer in the Console of your browserā€™s DevTools.

When using a direct implementation (in your source code) of Google Consent Mode, you should see the default consent states of the GCM storage types in the dataLayer.

After consent has been given for all GCM storage types based on the consent_status of the relevant Google DPS in your CMP Configuration, you should see a consent update.

With the consent default set in your code and a consent update from the Usercentrics CMP, the dataLayer will look similar to the following:

Script to check Google Consent Mode storage type consent states

If youā€™re using our GTM template to implement the Usercentrics CMP via a GTM tag, the default consent states of the GCM storage types won't be pushed to the dataLayer. They will be registered internally in the Google Tag Manager, so inspecting the dataLayer won't work to see them like in the example above.

However, you can execute the following script in the Console of your browserā€™s DevTools to get the Google Consent Mode settings:

(() => { Ā Ā 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"); })()

Your result should look similar to this, f.ex. after an Accept All on the CMP with relevant Google services for all the supported storage types added to the CMP Configuration:

Ā 

Usercentrics - PUBLIC