Update to Google Consent V2
This article will guide you on how to update Google Consent to Version 2. You can find the official information here.
Check your current tag that's working with Google Tag or Google Analytics.Example (before the update):
<script async src="<https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX>"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('consent', 'default', {
'ad_storage': 'denied',
'analytics_storage': 'denied'
});
gtag('config', 'G-XXXXXXXXXX');
</script>Because Google Consent V2 requires additional consent flags.
Add the additional consent values. Your updated code should look like this:
gtag('consent', 'default', {
'ad_storage': 'denied',
'ad_user_data': 'denied',
'ad_personalization': 'denied',
'analytics_storage': 'denied'
});These two lines are the additional settings:
'ad_user_data': 'denied',
'ad_personalization': 'denied',Also, you need to add those at
<script>
function consentGrantedAdStorage() {
gtag('consent', 'update', {
'ad_user_data': 'granted'
});
gtag('consent', 'update', {
'ad_personalization': 'granted'
});
}
</script>This is the final version of the script with Cookie Wow:
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
window.dataLayer.push(arguments);
}
// Initialize Google Analytics with default consent settings
gtag('js', new Date());
gtag('consent', 'default', {
'ad_storage': 'denied',
'analytics_storage': 'denied',
'ad_user_data': 'denied',
'ad_personalization': 'denied',
});
// Define wrapper to update consent if user accepts
function cwcCookieWrapper() {
if (window.cwcIsUserAccept && window.cwcIsUserAccept('analytics')) {
gtag('consent', 'update', {
'analytics_storage': 'granted'
});
}
if (window.cwcIsUserAccept && window.cwcIsUserAccept('marketing')) {
gtag('consent', 'update', {
'ad_storage': 'granted',
'ad_user_data': 'granted',
'ad_personalization': 'granted'
});
}
}
</script>Now you can test it.
Payment
Cookie Wow Subscription & Payment OptionsCookie Wow operates on a subscription model, meaning users can choose either a monthly or ye...
Cookie Banner Not Showing
Cookie Banner Not Showing — What Should You Do?If the cookie banner is not displaying on your website, it could result in cookies being u...
How to Pay via Bank Tranfers
If you'd like to proceed with this method, please contact sales@datawow.io and provide the following details:The plan you wish to subscri...
Get in touch and we'll help solve it