Google Consent Mode v2
Google Consent Mode is a new way to ensure a website’s cookies and visitor data comply with GDPR and other data privacy regulations.
To continue using Google Ads, Google Analytics, Google Tag Manager and target European users, you must implement Google Consent Mode v2 by March 2024.
For more information about Google, Consent Mode, read the official Google documentation https://developers.google.com/tag-platform/security/guides/consent
We have added the full functionality in version v4.3.2 of Joomla's Cookies Policy Notification Bar!
What's new in Consent Mode v2
Google Consent Mode v2 adds two new consent states, the ad_user_data which is used to set consent for sending user data to Google for advertising purposes, and the ad_personalization which controls whether data can be used for ad personalization (e.g. remarketing).
Let's see step by step how you can implement the Google Consent Mode v2
Step 1
Navigate to the plugin settings, click the Advance Settings tab, and then scroll down to the "Block Cookies by blocking their Javascript Code".
Choose the Google Analytics Category and place the code below. Of course you can also create your own cookies category instead of thre Google Analytics.
In the parameter field " Script Loading Time", you should check "Always Load" because you need to store the user even if therenot consent.
<script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('consent', 'default', { 'ad_storage': 'denied', 'analytics_storage': 'denied', 'functionality_storage': 'denied', 'security_storage': 'denied', 'personalization_storage': 'denied', 'ad_personalization': 'denied', 'ad_user_data': 'denied' }); </script> <!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-123456789A"></script> <script> gtag('js', new Date()); gtag('config', 'G-123456789A'); // Google Analytics gtag('config', 'GTM-1234ABC'); // Google Tag Manager gtag('config', 'AW-111-222-1234'); // Google Ads gtag('config', 'AW-123456789'); // Google Ads </script>
Do not forget to replace the G tags with yours (e.g. G-123456789A, GTM-1234ABC, etc.).
Screenshot
Step 2 (If User Consents)
Create another cookie script by clicking the green plus icon.
Choose the Google Analytics Category and place the code below.
In the parameter field " Script Loading Time", you should now check "Load After Consent".
<!-- AFTER CONSENT --> <script> gtag('consent', 'update', { 'ad_storage': 'granted', 'analytics_storage': 'granted', 'functionality_storage': 'granted', 'security_storage': 'granted', 'personalization_storage': 'granted', 'ad_personalization': 'granted', 'ad_user_data': 'granted' }); </script>
Screenshot
Step 3 (If User Declines)
Create another cookie script by clicking the green plus icon.
Choose the Google Analytics Category and place the code below.
In the parameter field " Script Loading Time", you should now check "Load After Decline".
<!-- AFTER DECLINE --> <script> gtag('consent', 'update', { 'ad_storage': 'denied', 'analytics_storage': 'denied', 'functionality_storage': 'denied', 'security_storage': 'denied', 'personalization_storage': 'denied', 'ad_personalization': 'denied', 'ad_user_data': 'denied' }); </script>
Screenshot