Data privacy regulations have brought consumer consent top of mind for marketers and consumers alike. Google introduced a beta feature to Google Analytics last fall called Consent Mode to help marketers manage the consent a consumer grants a given site or app. Consent Mode works through Google tags which fire different website behaviors based on any given visitor's consent.

How Google Analytics Consent Mode Works

Consent Mode in Google Analytics works as a JavaScript field value pair in the gtag.js analytics tag added to each page. Two field-value pairs are included, a default when the page is loaded and a consent field-value pair meant to work after user consent is granted.  

The following image from the Google analytics developer page demonstrates where the field-value pairs appears in the script.

Google Analytics consent mode example

The analytics is positioned at the top of the page, with the default field-value pair included. The second field-value pair, positioned lower in the code, is the consent field-value pair triggered by the user consent button.   

Marketers can direct developers to set the values for the two field types available: ad_storage for addressing privacy for digital ad campaigns and analytics_storage for adjusting measurements for privacy. The values determines if Goggle Analytics sets cookies for advertising — "denied" for no cookie created and "granted" for cookie setting. 

So what actually happens when a person visits a website page? A page loads after the person arrives on a given URL, triggering the analytics tags with the default field-value pair. The consent dialog pop-up banner appears next. When the visitor indicates their consent choice by clicking the agreement button on the banner, it triggers the consent field-value pair, inserting the ad_storage value, analytics_storage value, or both as set.

It should be noted that regardless of setting, the analytics tags still collect click information from the parameters appended to the URLs in digital ads, social media posts, QR codes and other media. The main purpose of the setting is to match user consent for privacy on a website or web app to the functionality of digital marketing campaigns that involve the website or app.

Learning Opportunities

Related Article: How to Turn Data Privacy and Compliance Regulations Into a Buyer Advantage

Getting More Granular With Consent Mode 

Developers can adjust other items in Consent Mode to improve website functionality. If your consent agreements require different agreement messages and buttons based on the visitor's location, a field-value pair allows for region-specific abbreviations. Given the different regional consent regulations the use of this options is clear. You can vary your combination of ad_storage and analytics_storage settings by regional campaign needs.

Settings are also available to adjust how page elements are loaded, such as an asychronous loading for the consent popup banner. In this instance, the tag allows a default 500 millisecond setting, which the developer can optimize if needed to minimize impact to page load speed and user experience.

There are other options for managing user consent in Google Analytics. If you are using Google Tag Manager alongside your analytics tag, you can edit consent settings for a tag through the tag manager consent API.

No matter how you plan your website or app experience, using consent mode in Google Analytics will help brands comply with the wishes of your visitors whenever they visit your website.