Google Consent Mode (GCM)

CookieHub offers integration with the recently introduces Google Consent Mode (beta) which helps advertisers to more effectively measure conversions, while respecting user consent choices for ads cookies and analytics cookies.

Please note that Google Consent Mode is still in beta on Google's side.

Ongoing issues with the GCM solution

While we have fully implemented the solution we have identified issues with the solution and that it may not work as intended.

Ideally when consent mode is enabled but the user has denied analytics, anonymous tracking data would be collected but that doesn't seem to be the case. Requests are sent to Google Analytics but they only show up in real time analytics but then dropped and not accessible in other sections of GA.

[Updated on Feb 17th 2021]  We are actively working with the Google integration team to figure out the cause and resolution.


How does it work?

With Consent Mode, your Google tags will be able to determine whether or not permission has been given for your site to use cookies for advertising purposes for that user. If a user consents, conversion measurement reporting continues normally. If a user does not consent, the relevant Google tags will adjust accordingly and not use ads cookies, instead measuring conversions at a more aggregate level.

More information on the Google Marketing Platform

CookieHub and Google Consent Mode

Enabling Google Consent Mode is easy, follow these steps based on how you are currently implementing Google Analytics on your web site.

Direct implementation (delayed javascript)

1. If you have already implemented CookieHub on your web site, remove the data-consent and type tags as they are not required anymore:

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXX-X"></script>
<script type="text/plain" data-consent="analytics">
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-XXXXXXXX-X');
</script><br>

2. Add the following code before the <script> tags for your Google Analytics code:

<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('consent', 'default', {'ad_storage': 'denied', 'analytics_storage': 'denied', 'wait_for_update': 500});
</script>

3. Enable Google Consent Mode for your domain in the CookieHub portal by clicking the domain name, clicking the Settings tab.

Thanks all! CookieHub will take care of the rest.

Here’s a fully functional example code:

<!-- Google Consent Mode -->
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('consent', 'default', {'ad_storage': 'denied', 'analytics_storage': 'denied', 'wait_for_update': 500});
</script>

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXX-X"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-XXXXXXXX-X');
</script><br>

Google Tag Manager

1. Add the following code above your Google Tag Manager integration code on your web site:

<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('consent', 'default', {'ad_storage': 'denied', 'analytics_storage': 'denied', 'wait_for_update': 500});
</script><br>

2. Change the firing trigger for the Google Analytics tag in GTM to CookieHub – Allowed Analytics or CookieHub – Loaded:

3. Enable Google Consent Mode for your domain in the CookieHub portal by clicking the domain name, clicking the Settings tab.

Thanks all! CookieHub will take care of the rest.

Still need help? Contact Us Contact Us