Correctly manage Google Consent Mode V2 on WordPress

How to implement Google Consent Mode V2 with PixelYourSite

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

Recommended Setup

Google Tag with PixelYourSite

Add the Google Tag with the PixelYourSite free or paid plugin.

Manage consent with ConsentMagic

Manage consent with ConsentMagic. It has native integration with PixelYourSite and full support for Google Consent Mode V2. Make sure the "Google Consent Mode V2" option is turned ON on the ConsentMagic Settings page, and everything is taken care of.

Alternative Setup 1

Google Tag with PixelYourSite

Add the Google Tag with the PixelYourSite free or paid plugin.

Manage consent with other consent solutions

Other consent plugins can use PixelYourSite's dedicated Google Consent mode filters.They can find our filters explained on the plugin's Consent page. You need to contact your consent provider for details.

Alternative Setup 2

Google Tag with PixelYourSite

Add the Google Tag with the PixelYourSite free or paid plugin.

Enable PixelYourSite's dedicated option

Enable "Fire Google tags with consent mode granted" to send the parameters with value "granted". This assumes you don't need permission from your visitors, or that you fire the Google tag after getting permission. Suited for websites that use consent plugins that block the tag before getting visitors' consent.

What is Google Consent Mode V2

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. A previous version of Google Consent (V1) had only two parameters. The extra two parameters were added in November 2023, resulting in the current setup (V2). 

For websites with traffic coming from EU countries, these parameters are mandatory starting March 2024. 

For websites with traffic from other geographic regions, the parameters are optional, depending on the local regulations, and the website privacy policy.

These is an example of the consent related code:

				
					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 that informs about tracking and allows to express consent. 

How Google Consent Mode should work for EU traffic

Under GDPR, visitors coming from EU countries must not be tracked without their consent. It means that when an EU visitor lands on your site for the first time, the Google Tag must have all the consent parameters sent with the value “denied“.

You need to inform them about the way you intend to track and use their data and ask their permission. If they grant you permission for one or multiple categories (analytics, marketing, personalized ads), you need to update the Google Tag accordingly.

Users have the right to change their minds at any time. This should be done in a user-friendly way. When they change their consent, you must update the Google Tag again.

How to manage Google Consent Mode with PixelYourSite

ConsentMagic

If the Google Tag is fired using the PixelYourSite plugin, the easiest way to implement Google Consent Mode is our consent plugin for WordPress, ConsentMagic. ConsentMagic has native support for PixelYourSite and automatically tracks and updates Google Consent parameters. 

Enable the “Google Consent Mode V2” option on the ConsentMagic Settings page.

Consent plugins that use our filters

If you use a different consent plugin, they can use PixelYourSite’s dedicated filters to instruct the plugin about the visitor’s Google Consent options. You must check with the consent plugin’s developers if they already do it.

Consent plugins that block the Google tags

Alternatively, you can use a consent plugin that blocks the tag until consent is expressed. In this scenario, PixelYourSite can be configured to always fire the Google Tag with a “granted” value for the consent parameters. Go to the Google Tags Settings page, and enable “Fire Google tags with consent mode granted”.

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.