The instructions below are to implement proper consent when using Google Tag Manager to deliver Google Services such as Google Analytics 4, Google Ads, Conversion Linker, and more.

 

⚠️ Note: Usercentrics is a Certified CMP Partner of Google. Regardless of which Certified CMP you use, these steps (or very similar steps) will need to be be taken for your website to be compatible with Google's Consent Mode V2.



Prerequisites

The overall approach to updating your consent tool to be compatible with consent mode is similar in nature for all Google certified CMP partners.  In this example, we will show how to make these updates using Termageddon (and its 3rd party partner Usercentrics CMP) along with Code Sniippets.

 

You will need access to:

  1. Your WordPress website (with the Code Snippets plugin installed/activated)

  2. Your Termageddon license set up with the consent solution.

  3. Your Google Tag Manager account, with the regular GTM script added to the <head> of your website.


Please note this is documentation to set up compatibility with Google Consent Mode.  This is not how to set up with the TCF framework.



Stage 1: Replace GTM script with new Consent Mode Script


Remove the original Google Tag Manager script from the <head> of your website:



<script> (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,’script','dataLayer','GTM-XXXXXX');</script>


Replace it with Google’s Consent Mode Script:


In your /wp-admin area of your website, go to Tools -> Termageddon + Usercentrics and then paste the code below in the Additional Scripts area:


<script type="text/javascript">

  window.dataLayer = window.dataLayer || [];

  function gtag() {

    dataLayer.push(arguments);

  }

  gtag("consent", "default", {

    ad_user_data: "denied",

    ad_personalization: "denied",

    ad_storage: "denied",

    analytics_storage: "denied",

    wait_for_update: 500

  });

  gtag("set", "ads_data_redaction", true);



  (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':

  new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],

  j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=

  'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);

  })(window, document, 'script', 'dataLayer', 'GTM-XXXXXX');

</script>


Don’t forget to replace GTM-XXXXX with the correct ID


Do not change the body tag (pasted below for convenience):

<!-- Google Tag Manager (noscript) -->

<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXXXX"

height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>

<!-- End Google Tag Manager (noscript) -->





Stage 2: Enable Consent Mode within Termageddon questionnaire, mark GTM as Essential


  1. Log into Termageddon: policies.termageddon.com

  2. Click into your license

  3. Click “Edit” for the Cookie Policy and Consent Tool

  4. Click ‘Enable’ for Google Consent Mode. 

  5. Click ‘Google Tag Manager | Edit’ -> Under General, change the Category to Essential

    1. Run a sitemap scan if not already. Also you can add services manually via “Add Service” -> “Pre-Defined”.

Stage 3: Decide on advanced vs basic for Google related Tags


When loading Google related tags through GTM (such aas Google Analytics, Google Ads, Conversion Linker, etc), you have the option to use “Advanced” or “Basic” consent mode.


Basic = most privacy friendly, less data, more steps

Advanced = more data, not as privacy friendly, less steps


Advanced Consent Mode only works for Google related products such as Google Analytics and Google Ads. Advanced is where Google utilizes cookieless pings to collect more data about the page interactions of a website visitor, without actually tracking that visitor using cookies. This is explained in more detail in the video. 


Advanced does not work for custom scripts or third party scripts such as HotJar or Microsoft Clarity.  For all non-Google products, you have to set up Basic Consent Mode. 


Basic consent mode requires users to set up a variable and a trigger, and update each tag to this new trigger.  These tags will only fire after explicit consent has been captured by the website visitor. 


You can also set up Basic Consent Mode for your Google related tags. This means these tags will not fire at all until after consent is captured. Basic is considered a best privacy practice, however the website owner will receive less data regarding their website visitors’ interactions with the website.


The following Google Services currently support the Advanced Consent Mode:


Service

Usercentrics ID

Consent Type

Conversion Linker

LykAT-gy

ad_storage

Display & Video 360

UekC8ye4S

ad_storage

Google Ads

S1_9Vsuj-Q

ad_storage

Google Ads Conversion Tracking

twMyStLkn

ad_storage

Google Ads Remarketing

B1Hk_zoTX

ad_storage

Google Analytics

HkocEodjb7

analytics_storage

Google Analytics 4

87JYasXPF

analytics_storage

Google Campaign Manager 360

dyHOCwp5Y

ad_storage

Search Ads 360

DHS2sEi4b

ad_storage




DEPRECATED PRODUCT

Usercentrics ID

Consent Type

Doubleclick Ad 

9V8bg4D63

ad_storage

DoubleClick Floodlight

ByzZ5EsOsZX

ad_storage

Google Campaign Manager

pxiRY9112

ad_storage




Stage 4: Set up Basic consent mode for all other (non Google related) Tags

Now we need to set up variables and triggers for the consent tool to respond to user consent choices and for those consent events to be properly captured within Google Tag Manager. This will allow us to set up triggers and then ultimately be able to update our tags to respond based on consent choices. 

Set up a variable

For this example, we will set up a Google Analytics 4 variable.  You will want to repeat this process for each Google Service you utilize within Google Tag Manager (see tables above).  Use the exact wording provided in the first column for the respective Google Service that you use (for example if you use Google Analytics 4, you must type that in exactly, not just Google Analytics, as that is technically a different Google Service).


  1. Navigate to Variables in the side-menu and then click on New.

  2. Name your variable. In this example, we will name it Google Analytics 4 Variable

  3. Add a new variable of type "Data Layer Variable".

  4. Under Data Layer Variable Name, insert Google Analytics 4.


⚠️ Note: Correct spelling, hyphenation and capitalization are mandatory for this field. Every technology must be added the way it is spelled in the Usercentrics Admin Interface. Here: "Google Analytics 4".


  1. Click/enable Set Default Value and type in false

  1. Click Save 


You have now set up the Google Analytics 4 variable.  Repeat this process for any other Google Services you use, outlined in the tables above. 



Set up a Trigger


For this example, we will now set up a Trigger for Google Analytics 4.  You will want to repeat this process for each Google Service you utilize within Google Tag Manager (see tables above).  


⚠️ Note: There are several ways to implement this logic. Usercentrics recommends the following option, however, depending on your setup, other structures might be more reasonable.


  1. Navigate to Triggers in the side-menu and click on New

  2. Add a title to your trigger. For this example, we will type in “Google Analytics 4 Trigger”

  3. Click Trigger Configuration and select Custom Event

  4. Click/enable Use regex matching 

  5. Under Event Name, paste in (consent_status.*)

⚠️ Note: Correct spelling, hyphenation and capitalization are mandatory for this field.

  1.  Click/enable Some Custom Events

  2. In the drop-down menus, set the following condition: "Google Analytics 4 Variable" contains true.

Explanation: The variable contains the user's consent information (variable=true - user opted in || variable=false - user opted out) for a specific technology. Hence, the trigger should only be fired (and tag therefore activated), if the variable=true.

  1. Clicks Save



You have now set up the Google Analytics 4 trigger.  Repeat this process for any other Services you use.


Add the Trigger to the respective Tag

  1. You can choose to pause your existing tags and create new ones, or you can modify your existing tags where you will remove the existing trigger and replace it with the new trigger. In this example, we will update an existing Tag.  You can still utilize the steps below if you are creating new tags (just remember to pause any existing tags prior to testing in the final step).

  2. Navigate to Tags in the side-menu and click on your Google Analytics 4 tag

  3. Remove the preexisting trigger(s) and replace it with the newly created “Google Analytics 4 Trigger”

  1. Click save



You have now set updated the Google Analytics 4 tag to fire only after a website visitor provides respectful consent.  Repeat this process for any other Google Services you use, outlined in the tables above. 



Stage 5: Testing


Test via the Preview Feature.  Don’t forget to clear out all cookies and do a hard refresh after making any changes.  Cookies should only load on the browser after consent is given. 


Key items:

  1. Properly clear your browser cache when testing in preview mode. This is absolutely essential.

  2. Inspect the code of the website (via the Chrome browser) and go to “Applications” -> “Cookies” to see cookies load and confirm this only happens after consent is given.


The video above outlines in more detail proper methods to testing to help confirm you’ve successfully implemented Google Consent Mode.