Try for free
Legal & compliance7 min read

Cookie consent banner: what the law requires and how to set one up

A cookie consent banner is only compliant if it does what it says: no non-essential cookies before consent, a reject option as easy as accept, and choices that stick. Here's what the rules require in the main jurisdictions, and how to set one up properly.

Published
Key takeaways
  • In the UK and EU, non-essential cookies need consent before they're set, with narrow exceptions.
  • Rejecting should be as easy as accepting: a 'Reject all' button on the first layer is the safe default.
  • Most banners fail in the set-up, not the design. Check that tags really wait for consent.
  • Keep a cookie policy that lists what you use and why, and review it when you add tools.

A cookie consent banner asks visitors whether they agree to cookies and similar technologies that aren't essential to run your site, such as analytics, advertising pixels, embedded videos and chat widgets. Whether you need one, and what it must do, depends on where your visitors are.

This is a jurisdictional topic, so this guide names the rules plainly. It's general information, not legal advice; if your situation is complex, take advice.

Where your visitors are The rule in short
European Union The ePrivacy rules require consent before storing or accessing information on a device, unless it's strictly necessary for a service the user asked for. GDPR sets the standard for valid consent.
United Kingdom PECR applies the same principle, with UK GDPR setting the consent standard. Since 5 February 2026, the Data (Use and Access) Act 2025 also exempts some analytics and site-appearance cookies from consent, if you tell people clearly and give them a simple way to object.
United States No single federal cookie law. Several state privacy laws, such as California's, require notice and a way to opt out of the "sale" or "sharing" of personal information, which can include advertising cookies.
Elsewhere Many countries have their own privacy laws. If you have significant traffic from a country, check its rules.

For most businesses with visitors from the UK or EU, the practical answer is yes: if your site uses Google Analytics, advertising pixels, LinkedIn or Meta tags, embedded YouTube videos or a third-party chat tool, you need a consent banner.

What counts as "strictly necessary"?

Strictly necessary cookies don't need consent. These are cookies the site can't work without for something the visitor has asked for:

  • keeping someone logged in
  • remembering what's in a basket
  • load balancing and security, such as fraud prevention
  • remembering the visitor's cookie choices

Analytics, advertising, social media pixels and most embedded third-party content are not strictly necessary in the EU. In the UK, the newer exemption can cover first-party analytics used only to improve your own site, but only with clear information and an easy way to object. Advertising and cross-site tracking still need consent everywhere in the UK and EU.

Regulators in the UK and EU have been consistent about what makes consent valid. The European Data Protection Board's cookie banner taskforce and the ICO's guidance both point the same way.

  1. Nothing non-essential before consent. Tags that need consent must not fire until the visitor agrees.
  2. Reject is as easy as accept. A "Reject all" option on the first layer, as visible as "Accept all". Making people click through to settings to refuse is the most common failing.
  3. No pre-ticked boxes. Silence, scrolling or pre-selected options aren't consent.
  4. Clear information. Say what each category does and name the main third parties, in plain language.
  5. Granular choice. Let people choose by category (for example analytics, marketing), not just all or nothing.
  6. Easy to change your mind. A link or icon on every page to reopen the settings and withdraw consent.
  7. No dark patterns. Don't use colour, size or wording to steer people towards accepting.
  8. Records kept. Your consent tool should log what each visitor agreed to and when.
See which cookies your site really sets
NetNav scans your site for cookies and trackers, flags any that load before consent, and tells you what to fix.
See how it works
Element Good Problem
First layer buttons "Accept all", "Reject all", "Manage choices", equal weight Only "Accept" and "Settings"
Wording "We use analytics cookies to see which pages are useful, and marketing cookies to measure our ads." "We use cookies to improve your experience."
Defaults Non-essential categories off until chosen Categories pre-ticked
Behaviour before choice Only essential cookies set Analytics fires on page load
Closing the banner Treated as no consent Treated as acceptance
Changing choices "Cookie settings" link in the footer No way back once dismissed

1. Find out what your site actually uses

List every cookie and tracker before you choose a tool. Check your tag manager, your CMS plugins, embedded content (video, maps, booking widgets, chat) and your analytics and advertising accounts. Open your site in a private browser window, open the developer tools and look at the cookies set on first load: anything beyond essential cookies is a problem to fix.

Most businesses use a consent management platform (CMP) rather than building their own. When comparing them, check that it:

  • blocks scripts until consent, rather than just showing a message
  • offers a first-layer reject button
  • scans your site and categorises cookies
  • logs consent
  • supports Google Consent Mode if you use Google Analytics or Google Ads
  • lets you style the banner to match your site and meet accessibility standards

3. Connect it to your tags

This is where most set-ups fail. The banner looks right, but tags still fire before consent.

  • In Google Tag Manager, use consent settings or triggers so each tag only fires when its category has been granted.
  • Hard-coded scripts in your theme need to be moved into the CMP's blocking mechanism or the tag manager.
  • Embedded videos and maps can be replaced with a placeholder until consent, or loaded in privacy-enhanced modes where available.

Consent Mode passes the visitor's choice to Google's tags, which then adjust how they behave. Google requires Consent Mode for some advertising features when you serve ads to users in the European Economic Area and the UK. Your CMP should handle this for you; check its documentation.

5. Test it

  • Open the site in a private window and check no non-essential cookies are set before you choose.
  • Click "Reject all" and confirm analytics and marketing tags don't fire (use your tag manager's preview mode or the browser's network tab).
  • Accept, then withdraw consent, and check tags stop.
  • Test on mobile, and with a keyboard only.

Your banner should link to a cookie policy, a page (or section of your privacy policy) that explains:

  • what cookies and similar technologies you use, by category
  • what each is for, and who sets it (you or a named third party)
  • how long they last
  • how to change or withdraw consent

Keep it up to date: every new tool you add to the site may add cookies. Our guide to website privacy policies covers the wider privacy notice.

Cookie compliance isn't a one-off. Sites drift as plugins, campaigns and embeds are added.

  • Re-scan monthly, or after any new tool or campaign tag is added.
  • Review the banner wording when you add a new category of tool.
  • Check analytics after changes. A big drop in recorded visits after a banner change can be expected, since people are refusing, but no data at all usually means a set-up error.

Questions

Is a cookie consent banner a legal requirement?

In the UK and EU, you need consent for non-essential cookies, and a banner is the usual way to get it. Strictly necessary cookies don't need consent, and in the UK some analytics and appearance cookies are now exempt if you inform people and let them object. Other countries have their own rules.

Do I need a cookie banner if I only use Google Analytics?

For visitors in the EU, yes: analytics cookies need consent. In the UK, first-party analytics used only to improve your site may fall under the newer exemption, but you must still tell people clearly and give them an easy way to object. Check how your analytics is configured before relying on it.

Does a cookie banner need a reject button?

Regulators in the UK and EU expect refusing to be as easy as accepting. A "Reject all" button on the first layer, as visible as "Accept all", is the safest way to meet that.

What's the difference between a cookie banner and a cookie policy?

The banner asks for consent at the moment someone arrives. The cookie policy is the page that explains in detail which cookies you use, why and for how long. You need both.

Can I just use a free cookie banner plugin?

You can, if it genuinely blocks tags until consent, offers a first-layer reject option and logs consent. Many free plugins only display a notice, which doesn't meet UK or EU rules.

About the author
Bálint Székely
NetNav

Every guide is checked against the platform it describes before it’s published, and re-checked when the platform changes.

Sources: Information Commissioner's Office, "Guidance on the use of storage and access technologies"; European Data Protection Board, "Report of the work undertaken by the Cookie Banner Taskforce" (January 2023); Data (Use and Access) Act 2025, section 112 (amending PECR regulation 6); in force 5 February 2026; Google, "Consent mode overview".
Free audit, ready in 20 minutes

See what's holding your website back.

Enter your website. You'll get your score, your plan and the first things to fix.

Try for free
No expertise needed
Your Blueprint in 20 minutes
No credit card required