Google Consent Mode V2 for GA Google Analytics

How to implement Google Consent Mode V2 with GA Google Analytics and ConsentMagic

or

If you already have a license, learn how to upgrade it.

GA Google Analytics Consent Setup

Google Tag with GA Google Analytics

Add the Google Tag on WordPress with the GA Google Analytics plugin.

Manage consent with ConsentMagic

Install the ConsentMagic plugin. Make sure that the Google Consent Mode option from the Settings page is turned ON.

What is Google Consent Mode

Google expects websites using the Google Tag to send four consent-related parameters that will instruct them how to track, store, and use your data.

These is an example of the consent related code where all the parameters are set to “denied”:

				
					gtag('consent', 'default', {
  'ad_storage': 'denied',
  'ad_user_data': 'denied',
  'ad_personalization': 'denied',
  'analytics_storage': 'denied'
});
				
			

The website should allow its visitors to express their consent options, and update the code accordingly. This is an example of a code sent when the ad storage option is modified from “denied” to “granted”:

				
					<script type="text/plain"  data-cs-class="cs-blocker-script" data-cs-slug="googleanalytics" data-cs-label="Google Analytics"  data-cs-script-type="132" data-cs-block="true" data-cs-element-position="body">
function consentGrantedAdStorage() {
  gtag('consent', 'update', {
    'ad_storage': 'granted'
  });
  }
</script>
				
			

In this example, when a visitor lands on the site for the first time, the Google Tag is fired but instructs Google that consent is not granted for any category. The visitor agrees to ad storage, and an update command is sent to Google. The interaction with the visitor is done through a consent popup triggered by ConsentMagic that informs about tracking and allows to express consent.

How to check if Google Consent mode works

Testing Google Consent mode is easy with tagassistant.google.com

Open your site, and look for the Consent tab. I will show you all the details you need. Change your consent options and check if the changes are reflected in the tag. 

PRO TIP: test your website in an incognito window.

Google Consent Mode V2

How to enable Google Consent Mode V2