Sign up with your Email and start sharpening your digital marketing skills.
Gain access to our free Full of Beans Academy courses
Exclusive email lessons
Updates on latest digital marketing trends and useful insights
Not interested
Google Consent Mode is a powerful tool for managing user consent and enhancing privacy compliance on your website.
Google has made it mandatory to have Consent Mode implemented before March 2024, so if you rely on Google Services such as Google Ads and Google Analytics, now is the time to get it implemented.
In this article you'll get a full overview on what the Consent Settings mean, how Consent Mode works, and how to set it all up using Google Tag Manager.
A gtag is a JavaScript library that helps you send event data to Google Analytics, allowing you to track user interactions on your website.
Example on a gtag:
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=your_ga_measurement_id"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'your_ga_measurement_id');
</script>
A gtag with consent settings incorporates Google Consent Mode, allowing you to dynamically adjust how Google tags behave based on user consent preferences.
Gtag with the default consent settings:
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=your_ga_measurement_id"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('consent', 'default', {
'ad_storage': 'denied',
'ad_user_data': 'denied',
'ad_personalization': 'denied',
'analytics_storage': 'denied',
'functionality_storage': 'denied',
'personalization_storage': 'denied',
'security_storage': 'granted'
});
gtag('config', 'your_ga_measurement_id');
</script>
Gtag with the Marketing Consent Settings:
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=your_ga_measurement_id"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('consent', 'update', {
ad_storage: "granted",
ad_user_data: "granted",
ad_personalization: "granted",
analytics_storage: "denied",
functionality_storage: "denied",
personalization_storage: "denied",
security_storage: "granted"
});
gtag('config', 'your_ga_measurement_id');
</script>
Gtag with the Statistical Consent Settings:
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=your_ga_measurement_id"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('consent', 'update', {
ad_storage: "denied",
ad_user_data: "denied",
ad_personalization: "denied",
analytics_storage: "granted",
functionality_storage: "denied",
personalization_storage: "denied",
security_storage: "granted"
});
gtag('config', 'your_ga_measurement_id');
</script>
ad_storage: "granted"
This means that the website or application is allowed to collect and store information for advertising purposes. The user has explicitly given permission for the storage of such data.
ad_user_data: "granted"
Sets consent for sending user data related to advertising to Google.
ad_personalization: "granted"
Enables consent for personalized advertising (remarketing).
analytics_storage: "granted"
Enables cookie storage related to analytics.
functionality_storage: "granted"
Enables storage that supports the functionality like language settings and other functions which requires cookies to work.
personalization_storage: "granted"
Enables storage related to personalization like video recommendations.
security_storage: "granted"
Enables storage related to security such as authentication functionality, fraud prevention, and other user protection.
If you haven't already I suggest you enable Consent Mode so you can set the Consent Setting for your tags:
Go to Tags in Google Tag Manager and in the top right corner just above your tags, you'll see a shield icon which is your Consent Overview.
Inside the Consent Overview you'll have an overview over the Tags which have not yet been configured and the tags you have configured. You'll notice that there is Build-in Consent Settings on your Google Tags.
You add Consent Settings by clicking the tag and then scroll down to the section "Consent Settings" where you can select "Require additional consent for tag to fire" and then click the button with the title "Add required Consent".
Test and confirm the tags are being fired only when there is a Consent Change.
On the event go to the tab Consent and check if the Consent Settings are applied. In this test I change from Default to have all the settings granted and it seems to be working well. In the screenshot you can see the state changed from all being "Denied" to the "Current State" being all "Granted":