In short: a cookie consent banner on WordPress is a plugin that asks visitors before any non-essential cookie is set. It holds analytics and ad scripts back until they agree, and it records their choice.
To set one up, install a consent plugin, scan your site and sort cookies into categories. Then block scripts before consent and give “Reject all” the same weight as “Accept all”. Finally, pass the choice to Google Tag Manager and Google Analytics 4 (GA4) through Consent Mode v2. That last step is what keeps your reports usable once people start saying no.
This guide is for owners of a WordPress website and the marketers who need a banner that meets privacy regulations without wiping out their data. It explains how the pieces fit together, what the rules actually say, how to pick a plugin, and how to wire everything into your tags. It is practical guidance, not legal advice.
How a cookie consent banner works on WordPress
Five things happen, in order, on every first visit. Once you see the chain, most configuration choices become obvious.
- The page loads with non-essential scripts held back. Analytics, ad pixels and embedded videos wait, while strictly necessary cookies (login, cart, security) run normally.
- The banner appears with Accept all, Reject all and a way to choose by category.
- The visitor’s consent preferences are stored, usually in a first-party cookie or in the browser’s localStorage, so the banner doesn’t come back on every page.
- The plugin releases allowed scripts and sends consent signals to tools that understand them, such as Google tags.
- The plugin logs a consent record, with a date, the categories accepted and the banner version, so you can prove what happened later.
A banner that only does step 2 is decoration, not compliance with the General Data Protection Regulation (GDPR). The legal value sits in steps 1, 4 and 5, which is why the plugin you pick matters more than the banner’s look.
Most plugins use the same four cookie categories: strictly necessary, functional (or preferences), statistics (analytics) and marketing (advertising). Only the first one runs without consent. The WordPress Consent API (WP Consent API), a free plugin on WordPress.org, uses similar category names so that other plugins can read the visitor’s choice. When your consent plugin and your analytics or form plugin both support it, they respect the same decision without custom code. The piece 8 Best WordPress Cookie Consent Plugins in 2026 makes a good next read.

What the GDPR and ePrivacy rules actually require
Two European texts set the cookie law that most website owners deal with. Article 5(3) of the ePrivacy Directive (2002/58/EC) requires consent before storing or reading anything on a visitor’s device, unless it is strictly necessary for a service they asked for.
The GDPR then defines what valid consent looks like. Its Article 4(11) says user consent must be freely given, specific, informed and unambiguous. German and French speakers call the same regulation DSGVO (the German name) and RGPD (règlement général sur la protection des données), so you’ll see all three names on plugin pages.
In practice, that definition turns into a short list of legal requirements for your banner.
- Prior consent: non-essential cookies stay off until the visitor acts. Loading Google Analytics first and asking afterwards fails this test.
- No pre-ticked boxes: the Court of Justice of the EU ruled in Planet49 (case C-673/17, 2019) that a pre-checked box is not valid consent.
- A real choice: the European Data Protection Board’s Guidelines 05/2020 on consent state that scrolling or continuing to browse is not consent. They also say that cookie walls generally don’t produce freely given consent.
- Easy withdrawal: GDPR Article 7(3) says withdrawing consent must be as easy as giving it. That’s why a floating “cookie settings” link or icon is standard.
- Proof: Article 7(1) puts the burden on you to demonstrate that consent was given, hence consent logs.
On wording, the law asks for clear and plain language, not a legal essay. Say which categories you use, what they do in one sentence each, and link to your cookie policy and your privacy policy. The cookie policy is a separate page listing each cookie, its purpose, its duration and whether it’s first-party or third-party.
The opt-out button is where regulators have been strictest. France’s data protection authority is the CNIL (Commission nationale de l’informatique et des libertés). In a decision made public in January 2022, it fined Google a total of €150 million because refusing cookies took more clicks than accepting them.
The lesson is simple: put “Reject all” on the first layer, at the same size and visual weight as “Accept all”. Under the GDPR, fines can reach €20 million or 4% of worldwide annual turnover, whichever is higher (Article 83(5)).
Beyond the GDPR: other privacy laws your visitors bring
The rules follow the visitor, not your server. An agency based in the United States (US) with European visitors still needs an opt-in banner for those visitors.
- UK: UK GDPR plus PECR (the Privacy and Electronic Communications Regulations), which mirror the EU opt-in approach.
- California: the California Consumer Privacy Act (CCPA) and its amendment, the California Privacy Rights Act (CPRA), work on an opt-out model. Sites in scope need a “Do Not Sell or Share My Personal Information” link. The state’s regulations also require honoring Global Privacy Control (GPC), a browser signal that says “opt me out”.
- Brazil and Canada: Brazil’s LGPD (General Data Protection Law) and Canada’s PIPEDA (Personal Information Protection and Electronic Documents Act) set their own rules. Quebec adds its Law 25.
- South Africa and Australia: South Africa’s POPIA (Protection of Personal Information Act) and the Australian Privacy Act also apply. Several consent plugins offer templates for these laws.
This is what geo-targeting is for. The plugin detects the visitor’s country and shows a strict opt-in banner in the EU and UK, an opt-out notice in California, and a lighter notice or none elsewhere. It’s usually a paid feature, and it’s worth it once a meaningful share of your traffic comes from several regions.

Choosing a cookie consent plugin for WordPress
The WordPress plugin directory is full of consent tools, and plenty of them only display a notice. Judge each candidate on the features below before you look at banner templates.
- Cookie blocking before consent, automatic for common tools and manual for custom code.
- Automatic cookie scanning that finds what your theme, plugins and embeds actually set, then sorts it into categories.
- Consent logging with export, so you can answer an audit.
- Google Consent Mode v2 support, plus Google certification if you run AdSense or programmatic ads. Those sites also need the Interactive Advertising Bureau (IAB) standard, the TCF (Transparency and Consent Framework).
- Multilingual support through WPML (WordPress Multilingual), Polylang or TranslatePress if your site has several languages.
- Integration and compatibility with your page builder (Elementor, Divi, Gutenberg) and your caching plugin.
- Where data lives: self-hosted in your WordPress database, or in the vendor’s cloud.
Where consent data lives is a real trade-off. A self-hosted cookie consent management platform (CMP), such as WPConsent, Real Cookie Banner or EC GDPR Cookie Banner from Entangle Commerce, keeps records in your own database and avoids pageview caps. A cloud-backed tool such as CookieYes or Cookiebot keeps your database lean and maintains a large cookie database for classification, but your records sit on someone else’s servers. This explainer is clearer than most.
The TCF only matters for ad-funded sites. Google requires publishers who serve personalized ads through AdSense, Ad Manager or AdMob to use a Google-certified CMP that integrates with the TCF. This applies to visitors in the European Economic Area (EEA), the UK and Switzerland. A brochure site for a local business can ignore it.
What common plugins actually do
These examples come from the plugins’ own listings. Features move between free and paid tiers, so check the current listing before you commit.
| Plugin | How it works | Worth knowing |
|---|---|---|
| CookieYes | Free plugin plus an optional free web app account | Banner works on activation; scanner, consent log and Consent Mode v2 need the free web app connection |
| Complianz | Setup wizard plus a cookie policy generator | Thorough, but the wizard takes time |
| Cookie Notice & Compliance | Lightweight banner, add-on for full compliance | Script blocking and scanning come with the Cookie Compliance add-on |
| Real Cookie Banner | Fully self-hosted, content blockers | No external calls for consent |
| WPConsent | Self-hosted, automatic script blocking | Placeholders for YouTube and Vimeo, honors GPC |
| Cookiebot, Borlabs Cookie, iubenda | Commercial CMPs | Suited to larger sites with many third-party services |
Which setup fits your site
| If your site is… | Do this | Avoid |
|---|---|---|
| A brochure site with GA4 only | Free plugin with script blocking and Consent Mode v2 | A notice-only plugin that lets GA4 load before the choice |
| A WooCommerce store running ads | Consent Mode v2 in advanced mode, Meta Pixel gated by category | Blocking checkout or payment cookies, which are strictly necessary |
| A publisher earning from AdSense | A Google-certified CMP with IAB TCF | A banner without TCF, which limits personalized ads in the EEA |
| A multilingual site | A plugin with WPML or Polylang support | An English banner shown to every visitor |
| An agency managing many client sites | One plugin and one configuration template across clients | A different consent tool on every site |

How to add the banner, step by step
The steps below work for most plugins, and menu names vary slightly. We use CookieYes and Complianz as examples because they cover the two main models: cloud-connected and wizard-driven.
- Install: in your dashboard, go to Plugins > Add New, search for the plugin, click Install Now, then Activate. CookieYes shows a working banner straight away. Other plugins, such as the Entangle Commerce one, leave it switched off until you enable it.
- Connect or run the wizard: for CookieYes, connect the plugin to a free web app account to get the scanner and consent log. The free plan allows 5 scans a month of up to 100 pages each. Complianz instead walks you through a wizard about your region, your tools and your policies.
- Scan your site: run the cookie scanner and review the results. Assign anything unknown to a category by hand.
- Write category descriptions in plain language. For example: “Analytics cookies help us understand which pages are read so we can improve them.”
- Choose the consent model: opt-in for GDPR regions, opt-out for US state laws, and geo-targeting if you need both.
- Set up script blocking (next section), then Consent Mode v2 if you use Google tags.
- Design the banner: pick a bar, box or cookie popup layout, then customize colors, font and logo to match your branding. Most plugins also accept custom CSS.
- Add a link that reopens the settings, usually in the footer. Plugins provide a shortcode for this, for example
[consent_banner_settings_link]in ProDev17’s small plugin (PD17 Cookie Consent Banner). - Publish your cookie policy page and link it from the banner and the footer. Complianz, CookieYes and WPConsent can generate a first draft from the scan results.
- Purge your page cache and CDN (content delivery network, such as Cloudflare), then test in a private window.
On a WooCommerce store, the steps are the same. The difference is in categories: cart, session and payment cookies are strictly necessary, while the Meta Pixel and Google Ads conversion tags belong in marketing.
Blocking scripts before consent
This is where most WordPress setups fail quietly. The banner looks fine, but Google Analytics has already set its cookies underneath it. There are four ways to hold scripts back, and a solid setup often combines two.
Automatic blocking by the plugin. WPConsent, for example, recognizes common services (Google Analytics, Google Ads, Meta Pixel, Microsoft Clarity, Google Tag Manager) and blocks them until the matching category is accepted. Real Cookie Banner does the same job with content blockers built from service templates. It’s the quickest option, and it covers tags added through plugins like MonsterInsights or WPCode.
Manual tagging of custom code. For JavaScript you added by hand, the usual pattern is to change the script’s type so the browser ignores it. The plugin then re-activates it after consent:
<script type="text/plain" data-fcc-category="marketing">
/* your tracking code */
</script>
The attribute name differs between plugins, so check your plugin’s documentation. Scripts hard-coded in a theme template are often not caught by automatic blocking, so move them into the plugin or into Tag Manager.
Blocking through Google Tag Manager. If all your tags live in a Google Tag Manager (GTM) container, the consent plugin only has to send signals, and GTM decides what fires. The next section covers this setup.
Placeholders for embeds. YouTube videos, Vimeo players and Google Maps set cookies as soon as they load. Good plugins replace them with a placeholder and a “load content” button until the visitor accepts.
Caching deserves a warning. A plugin that changes the page HTML depending on consent can clash with WP Super Cache, WP Rocket or a CDN. Plugins that handle the choice in the browser keep the cached HTML identical for everyone, which is the safer design for busy sites.

Connecting consent to Google Tag Manager and GA4
Blocking everything until consent is legal, but it creates gaps in your analytics. Google Consent Mode v2 is how you stay compliant while keeping usable data. It passes four consent states to Google tags:
analytics_storage: analytics cookies;ad_storage: advertising cookies;ad_user_data: sending user data to Google for advertising;ad_personalization: personalized advertising and remarketing.
The last two were added in version 2. Google requires them from advertisers who want to keep measurement and personalisation features for EEA traffic, which is why you’ll see “Consent Mode v2” on every plugin listing.
Basic versus advanced Consent Mode
In basic mode, Google tags don’t load at all until the visitor accepts. Google receives nothing before consent, so you lose those visits entirely.
In advanced mode, tags load with consent set to “denied” and send cookieless pings. GA4 and Google Ads then use those pings to model conversions and behavior for visitors who refused. Advanced mode keeps more data, but Google still receives a signal from visitors who said no. In our view, basic mode is the safer start if your legal adviser is cautious.
The GTM setup in practice
- In your consent plugin, enable Google Consent Mode v2 and set the default state to “denied” for EEA and UK visitors.
- Make sure the plugin’s default consent command runs before your GTM container. If you install the plugin’s own GTM template instead, fire it on the Consent Initialization – All Pages trigger.
- In GTM, open Admin > Container Settings and tick Enable consent overview. The shield icon on the Tags screen then shows each tag’s consent status.
- For Google tags (GA4, Google Ads), rely on their built-in consent checks. For other tags, such as the Meta Pixel or a heatmap, add Additional consent checks that require
ad_storageoranalytics_storage. - Publish the container, then check it in Tag Assistant’s preview mode.
If you set the defaults yourself, the command looks like this. Plugins with Consent Mode support write it for you:
gtag('consent', 'default', {
'ad_storage': 'denied',
'analytics_storage': 'denied',
'ad_user_data': 'denied',
'ad_personalization': 'denied',
'wait_for_update': 500
});
The wait_for_update value, in milliseconds, gives the banner time to load a returning visitor’s saved choice before tags fire. Google’s consent mode documentation lists every parameter.
Designing a banner people actually answer
A compliant banner can still offer a good user experience. The first layer should fit on a phone screen without covering the whole page, and it should say what you use cookies for in two sentences. Three buttons work well: Accept all, Reject all and Customize. Visitors should be able to accept or reject in one click, whichever they prefer.
Avoid the dark patterns regulators keep pointing at:
- a colored Accept button next to a grey text link for Reject;
- a Reject option hidden in the second layer;
- a smaller font for “Decline”;
- a close (X) button that counts as acceptance.
Accessibility counts too. Under WCAG 2.1 (Web Content Accessibility Guidelines), body text needs a contrast ratio of at least 4.5:1 with its background (criterion 1.4.3). Every button must also work with a keyboard (criterion 2.1.1).
Some plugins, including CookieYes and Complianz, state that their banner meets WCAG 2.1 level AA, the middle of its three conformance levels. Your custom colors can still break that, so check contrast after you brand it.
Remembering the choice is part of banner design as well. The EC GDPR Cookie Banner plugin keeps it for 90 days by default, and the CNIL recommends keeping a refusal for about six months before asking again. Asking more often than that annoys people and quietly lowers your consent rate.

Five mistakes that break compliance or data
1. The banner shows, but GA4 fires anyway. Symptom: _ga cookies appear before any click. Cause: the tag is hard-coded in the theme or added by a plugin the blocker doesn’t know. Fix: move the tag into GTM or the consent plugin, then retest.
2. Visitors see the banner again on every page. Symptom: consent never sticks. Cause: a page cache or CDN serving a stale version, or a security plugin stripping the consent cookie. Fix: purge all caches after each settings change, and exclude the consent cookie from any cookie-stripping rule.
3. Conversions collapse after the banner goes live. Symptom: GA4 and Google Ads lose a large share of conversions overnight. Cause: basic blocking without Consent Mode, so refusals leave no trace. Fix: enable Consent Mode v2 and check whether advanced mode suits your legal position.
4. The cookie list goes out of date. Symptom: the policy lists cookies you no longer use and misses new ones. Cause: a new plugin, embed or tag added after the first scan. Fix: rescan after every new tool and at least monthly on active sites.
5. Marketing tags ignore the choice. Symptom: the Meta Pixel fires after “Reject all”. Cause: non-Google tags don’t read Consent Mode on their own. Fix: add additional consent checks in GTM, or let the plugin block the pixel directly. commoninja.com published something useful on the subject.
How to check that it works, and keep it working
Test the way a regulator would, in a private browser window with no saved choice. Open your browser’s developer tools, then the Application tab and its Cookies list. Before you click anything, only strictly necessary cookies should be present.
Click “Reject all”, reload, and confirm that no _ga, _fbp or similar cookie appears. Then accept and check that they do.
For Google tags, Tag Assistant’s preview mode shows the consent state at each event. You can see the default “denied” values, then the update after the visitor clicks. If the update event comes after your tags fire, your order of loading is wrong.
Ongoing, three numbers are worth watching, and none of them needs extra visitor data.
The first is your consent rate, which plugins like CookieYes and EC GDPR Cookie Banner show in their dashboards. The second is the gap between GA4 sessions and your server-side or plugin pageview counts. The third is the number of unclassified cookies after each cookie scan. A sudden change in any of them usually means a new script or a broken setting.
Cookie consent banner WordPress checklist
- List the tools that set cookies: analytics, ads, pixels, embeds, chat.
- Install a plugin that blocks scripts, not only one that displays a notice.
- Scan the site and classify every cookie.
- Write plain-language category descriptions.
- Set opt-in for the EU and UK, opt-out for California, geo-targeting if needed.
- Block hard-coded scripts and embeds manually.
- Enable Consent Mode v2 with “denied” defaults.
- Add consent checks to non-Google tags in GTM.
- Give Reject all the same weight as Accept all.
- Add a footer link that reopens cookie settings.
- Publish and link the cookie policy.
- Purge caches, test in a private window, check Tag Assistant.
- Rescan after every new tool and review the consent rate monthly.
Where to start
Fix things in the order the law and your data care about. Stop scripts from firing before consent first, because that is the actual breach. Then add Consent Mode v2 so your reporting survives the change. Wording, design and geo-targeting can follow in a second pass.
For more practical guides on analytics, content and running a marketing site properly, browse the rest of our blog.
FAQ
Do I need a cookie banner if my site only uses WordPress’s own cookies?
Usually not for those cookies alone. Login, comment and shopping cart cookies that are strictly necessary don’t require consent under the ePrivacy Directive. The moment you add analytics, an ad pixel or an embedded YouTube video, you do.
Will a cookie banner slow down my WordPress site?
A well-built plugin adds little weight, especially one that serves its script from your own site. Blocking third-party scripts until consent can even make the first visit lighter. Check your Core Web Vitals before and after, since a large banner that shifts the layout can hurt them.
Is a free cookie consent plugin enough?
It can be for a small site, as long as the free tier actually blocks scripts and logs consent. Pricing varies widely between vendors, and the paid features most worth paying for are geo-targeting, multiple banner languages and IAB TCF for ad-funded sites.
Does my US-only site need a cookie consent banner?
US state laws such as the CCPA work on opt-out rather than opt-in, and they apply above certain size thresholds. If you have European visitors, though, the EU rules apply to them wherever your business is based.
Can I write my own banner instead of using a plugin?
You can, but you’d have to rebuild script blocking, consent storage, logging and Consent Mode signals yourself. For most sites, that’s more upkeep than a maintained plugin, and the logging part is easy to get wrong.
