How to Use GTM Consent Mode in Your Convert Experiences

Dionysia Kontotasiou
By
June 29, 2021 ·
How to Use GTM Consent Mode in Your Convert Experiences

When Google Analytics released the first features of Consent Mode, we were so excited to test them out and share with you why this is huge for Privacy. It’s a huge step in the right direction because it enables website operators to be GDPR-compliant and more aware of the ePrivacy Directive (ePD).

We’ve been patiently waiting ever since for news about a more holistic integration with Google’s preferred implementation solution, Google Tag Manager (GTM).

Just last month, Google announced new features that help their users determine and implement consent not just across Google tags, but any tags running in the GTM container.

Here’s a list of the new features that are available in both GTM 360 and free GTM containers:

1. New consent types (in addition to ad_storage and analytics_storage which were introduced with Consent Mode).

New consent types

2. Tag-specific consent settings with both built-in consent checks and additional consent checks.

Tag-specific consent settings

3. A new Consent Overview screen, where you can quickly check which tags have already been configured for additional consent settings and which are still waiting to be updated. This new screen needs to be enabled from the Admin Container Settings.

Admin Container Settings
new Consent Overview screen

4. New trigger types, with both a Consent Initialization trigger (which fires before anything else in the container) and an Initialization trigger (which fires before anything except the Consent Initialization trigger) being added to the mix.

New trigger type

5. New custom template sandbox APIs for making Consent Management Platform (CMP) templates.

How to Implement Google Consent Mode in Your A/B Experiences & Personalizations

Next, let’s see how you can use these new features in your A/B experiences and personalizations.

You can use these tips:

  1. Whether or not you’re using GTM to deploy your Convert Tracking Code.
  2. Whether or not you’re using a CMP platform (like Cookiebot, OneTrust, CookieConsent, CookieInformation, UniConsent, ConsentManager, Civic Cookie Control, iubenda, Didomi, Usercentrics) to respect visitor consent settings.

Before you proceed:

Did you know Convert Experiences integrates with well over 100 tools?

Take a look at how Convert integrates with these CMP platforms: Civic Cookie Control, Cookiebot, CookieConsent.

And how Convert integrates with Google Tag Manager.

Direct Implementation Without GTM & CMP

A few months back, we published instructions on how to push Convert data (experience/variation names-IDs) to Google Analytics by using event tracking. Using these instructions, you can now extend this use case to include Consent Mode for Google Tags.

Here’s what the default snippet would look like.

Remember, ideally, this would be positioned at the top of the page by placing the code in your Global Project Javascript area.

<!-- Global Site Tag - Consent Settings-->
window.dataLayer = window.dataLayer || [];
function gtag() { window.dataLayer.push(arguments); }
gtag('consent', 'default', {
  ad_storage: 'denied',
  analytics_storage: granted,
  wait_for_update: 500,
  region: ['US-CA']
});
<!-- Convert Experiences Event-->
gtag('event', Convert Experiences, {
  'event_category' : 'Experience',
  'event_label' : 'Experience1234098_Variation1'
});

The gtag() command above sets default consent settings for visitors from California (US-CA) to deny access to advertising and accept access to analytics storage. For these users, only cookieless pings will be sent to Google servers for ads, while analytics cookies can be stored.

Immediately after, another gtag() command can send the Convert event and notify for the same visitor which experience/variation they were bucketed into. This combination will allow you to get analytics with conversion data from the Convert app in your Google account.

Google Consent Mode Combined With GTM but Without CMP

If you are using GTM to deploy your Convert tracking code and want to take advantage of the new consent settings, follow the steps below.

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

<!-- 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>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXX');</script>
<!-- Convert Experiences Event-->
<script>
gtag('event', Convert Experiences, {
  'event_category' : 'Experience',
  'event_label' : 'Experience1234098_Variation1'
});
</script>

2. You should also update your GTM tag to take into account the new consent checks:

update your GTM tag

3. Finally, change the firing trigger for the Convert tracking code in GTM to Consent Initialization All Pages:

GTM to Consent Initialization All Pages

Google Consent Mode Combined With GTM & CMP

The above use case is fine, but keep in mind that Google Consent Mode does not replace a Consent Management Platform (CMP).

By pairing the Consent Mode API with the Consent Management Platform (CMP), CRO experts can indicate if the user has given consent for cookie usage related to analytics, ads, and/or advertising. The supported Google tags will respect this signal and adjust their behavior accordingly, only using cookies if consent was granted for those specific purposes.

Website operators can use Google Consent Mode instead of the prior blocking of the Convert tag. This is beneficial because the tag (and eventually your A/B experiences and personalizations) are not blocked outright when consent has not been given. Instead, Google will use the signal to adjust tag behavior based on the user’s consent preferences in the CMP.

Refer to this table that Google provides to see if your CMP supports the consent settings in GTM.

If your CMP supports the new GTM consent settings, feel free to follow their instructions and reach out to us if you need any help regarding your A/B experiences.

Thoughts?

In the new privacy environment where consent is a requirement, GTM must take an active role in helping improve transparency. It’s important to start looking at user consent as the first conversion point and looking critically at the user experience driving consent in this manner.

A/B testing the consent experience is a must. It will lead to a higher proportion of consenting users and more ethical data collection and audience creation processes – giving your business a competitive advantage over rival businesses. This is how you can optimize your website’s Consent Conversion Rate.

What do you think about the new consent management settings in Google Tag Manager? Are you willing to try these out while running your experiences with Convert?

Get a Taste of One of the Most Privacy Aware A/B Testing Tools Out There
Get a Taste of One of the Most Privacy Aware A/B Testing Tools Out There
Originally published June 29, 2021 - Updated November 10, 2022
Mobile reading? Scan this QR code and take this blog with you, wherever you go.
Authors
Dionysia Kontotasiou
Dionysia Kontotasiou Convert's Head of Integration and Privacy, helping customers with technical queries.
Editors
Carmen Apostu
Carmen Apostu In her role as Head of Content at Convert, Carmen is dedicated to delivering top-notch content that people can’t help but read through. Connect with Carmen on LinkedIn for any inquiries or requests.

Start Your 15-Day Free Trial Right Now.
No Credit Card Required

You can always change your preferences later.
You're Almost Done.
I manage a marketing team
I manage a tech team
I research and/or hypothesize experiments
I code & QA experiments
Convert is committed to protecting your privacy.

Important. Please Read.

  • Check your inbox for the password to Convert’s trial account.
  • Log in using the link provided in that email.

This sign up flow is built for maximum security. You’re worth it!