Cookie consent on WordPress: choosing a plugin that works with the rest of your site
On WordPress, tracking rarely comes from one place. Here's how a consent plugin reaches Tag Manager and your other plugins, what caching can break, and how to choose one for the sites you run.
The short answer
On WordPress, tracking often comes from several places at once, such as Tag Manager, the theme, analytics plugins, form plugins and WooCommerce. A consent plugin has to reach all of them. Choose one that supports Google consent mode and the WP Consent API, check how it works with your caching, and test it.
On this page
Where tracking hides on a WordPress site
Before you choose a plugin, list everything that adds tracking. On a typical WordPress site, that list includes:
- Google Tag Manager, and every tag inside it
- code pasted into the theme's header or footer, or added by a header scripts plugin
- analytics and pixel plugins that add GA4, Meta or other tags themselves
- form, booking and ecommerce plugins, including WooCommerce, which can send events of their own
- embeds such as videos, maps and chat widgets
A consent setting in Tag Manager reaches only the first. When I audit a WordPress site, finding the rest is the first job.
The WP Consent API in plain language
The WP Consent API is a free plugin that standardizes how plugins share the consent categories a visitor accepted. Your consent plugin records the choice, and other plugins that support the API can read it.
It needs both halves to do anything. It requires a cookie banner plugin and at least one other plugin that supports it. It also doesn't handle consent, and third-party scripts still have to be blocked by the consent plugin.
So check two lists before you choose. The API's plugin page lists the consent plugins that support it, including CookieYes, Cookiebot, Complianz and iubenda. Then check whether your analytics, form and ecommerce plugins support it too.
Tag Manager and Google consent mode on WordPress
If Tag Manager runs your Google tags, the consent plugin sets the default consent state before tags fire and updates it when the visitor chooses, and the tags follow it. That part works the same as on any site, and A CMP and Google Consent Mode explains it.
The WordPress part is making sure tracking outside Tag Manager follows too. CookieYes's plugin, for example, says it passes consent signals to Google Tag Manager through Google consent mode v2 and shares consent states with other compatible plugins through the WP Consent API. If a plugin adds GA4 itself instead of through Tag Manager, check whether it reads that choice.
Caching and script optimization
Caching and script optimization plugins change how and when scripts load, and that can delay or break the banner. CookieYes's documentation says WP Rocket's caching may interfere with its script, leaving the banner empty or showing errors. Its plugin now excludes its scripts from WP Rocket automatically, but other optimization settings can still get in the way. Cookiebot documents the same problem with caching and optimization plugins. After any change to caching or script settings, clear the cache and test the banner again.
Choosing a consent plugin for WordPress
- CookieYes is what I currently suggest for most small and mid-sized sites, and I've set it up on WordPress. Its plugin supports Google consent mode v2 and the WP Consent API and works with WooCommerce.
- Cookiebot is one I've also set up on WordPress. Its plugin supports Google consent mode v2 and is integrated with the WP Consent API.
- Termly is another I've set up on WordPress. Its plugin supports Google consent mode v2 and IAB TCF v2.2. I used to suggest Termly and now suggest CookieYes to most clients, because its features fit them better, and Termly can be too basic at times. Termly also says its plugin supports the WP Consent API.
- Complianz is a reasonable fit if you don't need much customization. Its plugin supports Google consent mode v2 and the WP Consent API. If you want control over how the banner and categories behave, it's the wrong pick.
- OneTrust or Usercentrics fit larger organizations, or a company that already runs one CMP across many sites. In my setups they're the two most configurable platforms. Check how each installs on WordPress before you commit.
For the other platforms, see the full comparison, which CMPs Google certifies and which CMPs US sites use.
Whether your site needs a banner, and what it has to offer visitors, is a question for your counsel. I handle the setup and the testing.
For agencies
If you run many client sites on WordPress, use one consent plugin across them where you can, so setup and testing are the same everywhere. Keep a list, for each site, of the plugins that add tracking. Retest the banner after plugin and theme updates, because an update can add a script or change how one loads.
What to test after setup
Here's a sample checklist. Run through it after accepting, after declining, and with Global Privacy Control turned on, starting each run in a fresh private window.
- Tag Manager tags follow consent mode. In Tag Assistant, the consent state should change with the visitor's choice.
- Analytics and pixel plugins follow the choice. Look for their requests in the browser's network panel before any choice is made.
- Embeds wait for consent where they should. Videos, maps and chat widgets can set cookies of their own.
- Forms and WooCommerce purchases still reach GA4 when consent is given. Submit a test form and place a test order, then find both in GA4.
- The banner still appears on cached pages. Load a page as a logged-out visitor after the cache has been built.
Questions people ask
Which consent plugins support Google consent mode?
CookieYes, Cookiebot, Termly and Complianz all say their WordPress plugins support Google consent mode v2. Whether the signals arrive correctly depends on how the plugin connects to your tags, so test it after setup.
Do I need the WP Consent API?
You need it if other plugins on your site should know the visitor's choice, such as analytics, form or ecommerce plugins that support it. It needs a consent plugin to work, and it doesn't block scripts itself.
Why does my banner disappear after caching?
Caching and script optimization plugins can delay, combine or defer the banner's script, so it loads late or not at all. Exclude the consent plugin's scripts from optimization as its documentation describes, then clear the cache and test again.
