Consent mode is Google’s solution to strike a balance between keeping advertisers/marketers happy by providing accurate data for analysis and advertising purposes, while giving users some control over how much of their data can be used.
Analytics and advertising providers like Google, HubSpot, Meta, and Mailchimp, to name just a few, are constantly updating how they track users to stay up-to-date with data privacy regulations.
Consent mode was designed to give users control over the data collected by platforms. Once you configure it properly on your website, visitors can opt out of tracking without causing you to lose all of your data.
Here is how this works: When a visitor lands on your website, a cookie banner is displayed. If consent mode is not configured, here is what will happen:
In this case, data will be sent as expected to your Google Analytics and other platforms.
No data will be sent to Google Analytics or any other platform, even if it supports consent mode.
Once you set up consent mode, data loss may still occur, but you won’t lose all of it.
Once you configure consent, the CMP will keep you constantly updated on changes in consent state. For instance, if a user accepts cookies via the cookie banner then changes his mind, the CMP will send a signal to GTM to stop tags from firing.
A useful analogy is to think about the CMP as a guard that monitors traffic, and GTM as a barrier. If the guard gives you the green light, the barrier gets lowered.
Once the user gives their consent or denies cookies via the cookie banner, the CMP will send an update event. For example, CookieYes sends a cookie_consent_update
event with updates on consent states.
ad_storage
is denied), GTM will look for all tags that require ad_storage
and prevent them from functioning. Although the configuration will depend somewhat on the CMP of your choice, the process is more or less the same if you use a CMP that integrates with consent mode.
In the following example, we will use CookieYes, a CMP that integrates with consent mode.
Create your account and get the ID.
Next, we will create a new tag using the CookieYes tag template.
All we need to do is add the ID we copied earlier. Next, we will need to configure default consent states. As a general rule, you want tracking to be switched off by default until the user gives permission.
Most of Google’s services can automatically detect consent without needing any additional configuration.
We will select all of them and add to the “Require no additional consent” list.
This is the tricky part. Many of the most commonly used third-party tags are not supported by consent mode. For instance, if you are using the Facebook Tag, you will need to configure additional consent requirements.
Instead of going to each tag and modifying consent settings individually, you can do this in bulk using the consent overview feature.
ad_storage
to our advertising tags before moving on to analytics_storage
for analytics tags, and so on. Tags with no built-in consent detection are blocked. If you have properly followed this step, you will see all tags falling into this category in the “Blocked because of missing consent” section.
Consent mode is not a perfect solution, but it is certainly a significant improvement compared to using a plain trigger to control your tags’ behavior and potentially losing all data in case users deny cookies.
The amount of work required depends on how well your CMP integrates with GTM’s consent overview. In addition to the cookie banner, a CMP needs to consistently communicate with GTM by sending consent updates. This ensures that the consent states are accurately reflected in the tag firing behavior.
Automated page speed optimizations for fast site performance