Google Consent Mode: With Google Tag Manager (GTM), you can simplify the process of tag configuration by using pre-configured templates created specifically for your GTM configuration.
In the GTM Gallery you can choose from a library of templates that you can easily add to your installation.
⏰ Short on time? Jump straight to How To Start!
Google Tag Manager (GTM) is a powerful tool used for efficiently managing website tracking codes, commonly referred to as GTM tags. But what is GTM, and how can you use it to your advantage?
GTM stands for Google Tag Manager, a free tool offered by Google. GTM tags are snippets of code that serve various purposes, such as collecting data and facilitating communication between your website or app and external analytics and marketing platforms.
Google Tag Manager is primarily used for simplifying and centralizing the management of these tags on your website or app. It eliminates the need for manual code implementation, streamlining the process and reducing the risk of errors. It’s a versatile tool that helps you manage and deploy tags more efficiently.
This guide specifically explains how to integrate Google Consent mode with the iubenda Privacy Controls and Cookie Solution template. However, if you prefer to set up Google Consent mode without using the template, you can follow this guide.
If you’re looking to simplify the blocking of cookies and trackers using Google Tag Manager together with the auto-blocking feature, it’s important to note that the related snippet cannot be loaded directly via GTM. However, you can still refer to the following guide to streamline the cookie-blocking process using GTM.
By using the Google Tag Manager Template, you can automate the following tasks:
First, you have to create a GTM account and set up a container.
Then, you’ll be required to paste the GTM snippet into your website’s <head> section.
Finally, you’ll reach the GTM dashboard.
Once in the dashboard, click on Add a new tag.
Then, click on the Tag configuration area, select “Discover more tag types in the Community Template Gallery”, click on the magnifier icon, and search: iubenda
Select “iubenda Privacy Controls and Cookie Solution” and click “Add to workspace” to add it to your GTM installation.
Before setting up the template, you need to import it. Here’s how:
Once back in the dashboard, click on Add a new tag.
Then, click on the Tag configuration area, scroll down to the Custom section, and click on iubenda Privacy Controls and Cookie Solution to add it to your GTM installation.
Once you have added the template, you will get to the Tag configuration page.
Here you will have to:
The defaults are all set to
Denied to ensure the best privacy protection for your users.
Keep in mind that several legislations (for example, the GDPR) specifically require that consent is the result of positive action on the user’s part, so we suggest being extremely careful in modifying such parameters.
For more information about Consent types, you can check the Google official documentation here.
denied(Targeting & Advertising purpose). It can be used to send event and session-based analytics (including conversions) without cookies across pages.
You can see the official Google Tags documentation for further information about these parameters.
In this part of the process, you can embed the Privacy Controls and Cookie Solution directly within the tag (recommended option) or manually.
If you choose to embed the Privacy Controls and Cookie Solution directly via the template, you have to copy your embed code from the iubenda Privacy Controls and Cookie Solution embedding section and paste it into the CS configuration box of the template.
As you may notice, the code to paste is slightly different from the code included on your iubenda embedding page.
This is because only the configuration part (_iub.csConfiguration) of the embedding code displayed should be filled in this section.
Here you can find an example of the parts not to paste into the box (strikethrough)
You can also embed the Privacy Controls and Cookie Solution code manually. To do that, you have to follow the standard embedding method described in this guide.
❗️ To make sure this method works correctly, remember to add the parameter:
"googleConsentMode": "template" to your Privacy Controls and Cookie Solution configuration.
Finally, you can choose the Privacy Controls and Cookie Solution channel (Beta, Current, Stable).
In this section, some advanced settings can be set up, such as the Tag firing priority, Tag Sequencing, and advanced Consent settings. Please note that there’s no need to edit these settings for the template to work, so if you’re unfamiliar with them, you can ignore them.
After configuring the tag, you need to set up the trigger to make the tag fire.
You can select “Consent Initialization – All Pages” as the trigger.
After completing the configuration, click the Save button at the top right of the page. The tag is now ready to be published.
From the GTM dashboard, click on Submit at the top right of the page:
Finally, add a version name and description, click on Publish, and that’s it! The tag is up and running, seamlessly integrated with our Privacy Controls and Cookie Solution!
Tags like Google Ads, Analytics, Floodlight, and Conversion Linker have built-in consent checks. They are natively compatible with Google Consent Mode.
This implies that these tags possess a mechanism that alters their functionality in response to the user’s consent status.
Please note that no consent configuration is needed for this type of tags.
You can simply assign “All pages” trigger to tags that have built-in consent checks like Google Ads, Google Analytics, Floodlight or Conversion Linker
Tags that engage in tracking but are not compatible with built-in consent checks need to be set using additional consent checks. For example, if you use a Custom HTML tag, this is the right feature for you if you want to release a tag after consent is given.
The following procedure is valid for GTM tags that don’t support natively Google Consent Mode (for example, Custom HTML tags for embedding Facebook Pixel, Hotjar, or other custom scripts).
First step: Add
"emitGtmEvents":true parameter to the Privacy Controls and Cookie Solution script;
In the following example, we create a custom HTML tag with an Hotjar script (but it can be any other script like Facebook Pixel, etc.)
Next, let’s set up prior blocking using additional-consent-checks of the Google Consent Mode
|Purpose||Google Consent Type(s)|
You only need to create a custom event with the following properties:
Note: when the user preferences change, the Privacy Controls and Cookie Solution sends the event
iubenda_gtm_consent_event to GTM
Prior-blocking is set for the tag!
The explanation for built-in and additional consent checks is also valid in this case. If you enable US Law in the ‘Privacy Controls and Cookie Solution’ configurator, the default behavior for a US user is that the Cookie Solution sets all the GCM (Google Consent Mode) purposes to ‘granted‘.
Note: If you are on a “Free” Plan, this is true if you disable GDPR and apply only US Law in the configurator. Alternatively, if you want to apply GDPR for EU Users and US Law for US users, you’ll need at least an “Advanced” plan.
When the user opts out of a specific purpose under US Law, we adjust the settings for ‘
ad_storage‘ and ‘
ad_storage‘ is granted when the user either hasn’t opted out of any of the following USPR (US Privacy Rights) purposes or when they are not relevant (e.g., USPR does not apply):
analytics_storage‘ is set to granted when the user either hasn’t opted out of the US purpose ‘Sale of my personal information’ (purpose s) or when it’s not relevant (e.g., USPR does not apply).
Apply US Law exclusively for US users, and unlock the full range of iubenda’s features