What Consent Mode v2 changes on a WordPress site
Google Consent Mode v2 is how Google tags learn what the visitor accepted. It relies on four signals: ad_storage, analytics_storage, ad_user_data and ad_personalization. Since March 2024, Google requires the two newer signals for visitors in the European Economic Area if you want to keep remarketing, audiences and full conversion measurement in Google Ads. Our Google Consent Mode v2 implementation guide explains the mechanism in detail; this article covers what is specific to WordPress.
Consent Mode does not replace consent. Under the GDPR and the ePrivacy rules, analytics and advertising cookies still need a prior, free choice. Consent Mode only passes that choice to Google tags so they behave accordingly.
On WordPress, the difficulty is not the code. It is the number of places that can load a Google tag:
- Site Kit by Google, which places the GA4 and Google Ads tags when you connect those services;
- an analytics or ecommerce plugin (MonsterInsights, Google Analytics for WooCommerce, a Google Tag Manager plugin);
- code pasted in the theme or in a header plugin such as WPCode;
- a tracking field in a page builder or theme settings.
Each of them can print a gtag before or after your banner, and each may follow a different consent source.
The two ways to set up Google Consent Mode on WordPress
Route 1: Site Kit and the WP Consent API
The WP Consent API is a free plugin from the WordPress.org directory. It shows no banner. It acts as a shared layer: the consent plugin writes the visitor's choice into it, by category (statistics, marketing, preferences), and other plugins read that state.
Site Kit by Google uses this layer. Its settings include a Consent Mode option that adds the default and update consent commands to the Google tags Site Kit places. When you switch it on, Site Kit checks whether the WP Consent API is active and offers to install it. Your consent plugin must then write to the WP Consent API: Complianz, iubenda and WebToffee's GDPR Cookie Consent, among others, state that they do. Site Kit itself says it cannot verify compatibility with every plugin, so test the result.
This route suits sites where Site Kit places every Google tag and nothing else loads Google.
Route 2: a consent banner snippet at the top of the head
The second route places a Consent Mode stub and the consent banner as the first scripts in the <head>, through a header plugin such as WPCode or a child theme hooked to wp_head with a low priority. The stub declares the four signals as denied while the HTML is parsed, before any Google tag. When the visitor clicks, the banner sends gtag('consent', 'update', …) and loads, or keeps blocked, the services declared in it.
This route works whatever loads Google (GTM, theme code, a plugin), as long as the stub runs first. It also blocks non-Google scripts such as Meta Pixel or Hotjar, which Consent Mode alone never controls. Its condition: Site Kit must stop placing its own tags, otherwise you have two sources of truth.
Which route to choose
Pick one consent source per tag, never two.
- Site Kit places all your Google tags and you only use Google: route 1 is consistent. Use a consent plugin compatible with the WP Consent API, switch on Consent Mode in Site Kit, and do not add a second gtag.js anywhere else.
- Your tags live in Google Tag Manager or in theme code, or you also run non-Google pixels: route 2 is simpler and more complete. Turn off tag placement in Site Kit (it keeps showing your statistics in the dashboard) and let the banner drive Consent Mode. Our Google Tag Manager and Consent Mode v2 guide covers the GTM side.
- You run both today: this is the most fragile setup. The banner says "refused" while a Site Kit tag follows a WP Consent API state, or the other way around. Choose one route and remove the duplicate.
Not sure what your site loads before consent? Check it first: run the free cookie scanner on your home page and on a blog post to see in 30 seconds which cookies are set before any choice.
The choice between Basic and Advanced mode applies to both routes. In Basic mode, Google tags wait for consent; in Advanced mode, they load in cookieless mode and send anonymous pings after a refusal. Our comparison of Consent Mode basic vs advanced explains what each mode does to your data.
How to set up Consent Mode v2 on WordPress step by step
With route 1 (Site Kit and WP Consent API)
- Install a consent plugin that states it is compatible with the WP Consent API, and map its categories (statistics, marketing).
- In Site Kit, open the settings, find the Consent Mode option and switch it on. Install the WP Consent API when Site Kit offers it.
- Check that Google Analytics and Google Ads are connected in Site Kit, and remove any other GA4 or Google Ads code from the theme, WPCode or a GTM container.
- Follow your consent plugin's documentation about its own Consent Mode setting: several advise leaving it off when Site Kit handles Consent Mode, so that only one component sends the
defaultcommand. - Clear every cache, then test (see below).
With route 2 (banner snippet in the head)
- Copy your banner snippet: the Consent Mode stub first, then the banner loader.
- Install WPCode, open Code Snippets → Header & Footer and paste the snippet at the very top of the Header field, above any existing code. Without a plugin, use a child theme and hook the snippet to
wp_headwith priority1. - If you use GTM, keep its container below the snippet, never above.
- In Site Kit, turn off Place Google Analytics code (and the same option in any other Site Kit module that places a tag), then declare GA4 and Google Ads as services in your banner so they load only after consent.
- Deactivate any other cookie plugin so visitors see a single banner.
A concrete example: with FlowConsent, the snippet copied from the dashboard already contains the stub with the four denied defaults, wait_for_update, url_passthrough and ads_data_redaction, followed by the banner loader. You paste one block and the order is right by construction.
Cache, optimization and WooCommerce: the WordPress traps
- "Delay JavaScript" and "defer" options. WP Rocket, LiteSpeed Cache, Autoptimize or W3 Total Cache can move scripts to the bottom of the page or hold them until the first interaction. If the stub is delayed, Google tags run without defaults. Exclude the stub and the banner domain from these options.
- Cached pages. After any change, purge the plugin, host and CDN caches, otherwise visitors keep receiving the old version without the stub.
- Google Analytics for WooCommerce. This extension loads its own
gtagand sets its own Consent Mode defaults. Either remove it and declare GA4 in the banner, or check that its tag lands below the stub and adjust its defaults with thewoocommerce_ga_gtag_consent_modesfilter documented by WooCommerce. - Themes and page builders. A tracking ID typed into a theme or page builder setting prints a tag you may have forgotten. Search your page source for
G-andAW-IDs.
Our WordPress cookie consent guide covers the rest of a WordPress site's compliance, from plugins to the cookie policy.
How to check that Consent Mode v2 works on WordPress
- Open the site in a private window and, before clicking anything, look at requests to
google-analytics.comorgoogleadservices.comin the Network tab. In Advanced mode you may see pings carryinggcs=G100(all denied); in Basic mode you should see nothing. - Click Refuse: no
_gaor_gcl_aucookie should appear. - Click Accept: the next hits should carry
gcs=G111. - In Google Tag Assistant, the Consent tab should show a
defaultstate before any tag, then anupdate. - Always test logged out: some plugins can exclude logged-in users from tracking, which hides the problem.
Our guide on how to check that Google Consent Mode v2 is working details each test.
Common mistakes on WordPress
- Site Kit placing GA4 and a gtag.js in WPCode at the same time: double tracking and two consent sources.
- A consent plugin that does not write to the WP Consent API while Site Kit's Consent Mode is on: Google receives a consent state your visitors never set.
- GTM pasted above the consent snippet: the
configcommand reaches Google before the defaults. - The stub caught by a "delay JavaScript" option: tags fire before the defaults exist.
- Testing only the "Accept" path. The refusal path is the one that has to hold legally.
How FlowConsent handles Consent Mode v2 on WordPress
FlowConsent follows route 2. You paste one snippet at the top of the WPCode Header field or in a child theme: it sets the four Consent Mode v2 signals to denied before any Google tag, then sends the update as soon as the visitor chooses. GA4, Google Ads or Meta Pixel are declared as services and load only after consent, cookies are scanned automatically, and every choice is stored in an exportable consent proof. Installation takes about ten minutes, the banner is hosted in Europe, and the plan is free up to 25,000 sessions per month (Pro at €14.99 per month up to 100,000). The WordPress installation guide shows how to turn off Site Kit's tag placement and exclude the snippet from cache plugins.