Cookies & tracking
Cookie categories explained: necessary, functional, analytics and marketing
Most cookie banners sort cookies into four groups: strictly necessary, functional, analytics and marketing. Only the first can run without consent in the EU and UK, so putting each cookie in the right group is what makes your banner work.
- Plain English
- Written for website owners
- Free to read
On this page
Cookie banners typically sort cookies into four categories: strictly necessary (needed for the site to work, no consent required), functional (extra features and preferences), analytics (measuring how the site is used) and marketing (advertising and cross-site tracking). In the EU and UK, every category except strictly necessary needs the visitor's consent before its cookies are set. Each cookie belongs in a category based on its purpose, not on who provides it or whether it's first-party.
This guide explains each category with real examples and gives you a simple process to classify any cookie.
Where the categories come from
No law defines these four names. The legal line, in Article 5(3) of the ePrivacy Directive and the UK's PECR, is simpler: a cookie is either strictly necessary for a service the user requested, or it needs consent.
The categories exist because consent under the GDPR must be specific. A visitor should be able to say yes to analytics without saying yes to advertising. Grouping cookies by purpose makes that choice manageable. Asking about each of 40 cookies would overwhelm anyone. The four-group model became a common convention in the UK through the ICC UK cookie guide in 2012, and most consent tools use a variation of it today.
The four categories at a glance
| Category | Purpose | Consent in EU/UK? | Typical examples |
|---|---|---|---|
| Strictly necessary | Make the site or a requested feature work | No | Login session, cart, CSRF token, load balancing, consent choice |
| Functional | Remember preferences, enable optional features | Usually yes | Chat widgets, embedded maps, saved non-essential preferences |
| Analytics | Measure visits and behavior to improve the site | Yes, with narrow exemptions | Google Analytics, Matomo with cookies, Hotjar, Microsoft Clarity |
| Marketing | Advertising, retargeting, cross-site profiling | Yes | Meta Pixel, Google Ads, TikTok Pixel, LinkedIn Insight Tag |
Strictly necessary cookies
These are cookies the site can't deliver a service the visitor asked for without. The test is narrow. "Useful to us" or "important for the business" doesn't qualify. Typical examples:
- Session and login cookies, such as
PHPSESSID,ASP.NET_SessionIdorJSESSIONID, which hold the visitor's session. - Shopping cart cookies that remember what's in the basket.
- Security cookies: CSRF tokens, and bot-protection cookies such as Cloudflare's
__cf_bm. - Load-balancing cookies that keep a visitor on the same server.
- The consent cookie that remembers the visitor's cookie choice.
Common mistakes are putting analytics, A/B testing or fraud-scoring tools that also serve advertising into this category. If removing the cookie would only make your reporting worse, it isn't strictly necessary. Edge cases are covered in what counts as a strictly necessary cookie.
Functional cookies
Functional (or "preference") cookies enable features that improve the experience but aren't essential to the service the visitor asked for. Examples:
- live chat and customer support widgets,
- embedded maps, booking calendars and similar third-party widgets,
- remembering a region, currency or display preference across visits,
- some video players, if they don't track for advertising.
There's a nuance. If a visitor actively picks a language from a menu and you store that choice, many regulators accept it as necessary, because the visitor requested it. A cookie that guesses preferences or keeps them for a long time is functional and needs consent. Many third-party widgets also collect data for the vendor's own purposes. Check each vendor's documentation, because a "chat" widget that also tracks for advertising belongs in marketing.
Analytics cookies
Analytics (or "performance" or "statistics") cookies measure how visitors use the site: page views, traffic sources, journeys and errors. Examples:
- Google Analytics 4:
_gaand_ga_<container-id> - Matomo, when cookies are enabled:
_pk_id.*and_pk_ses.* - Hotjar:
_hjSessionUser_<site-id>and related cookies - Microsoft Clarity:
_clckand_clsk
In most of Europe, analytics needs consent. There are narrow exceptions. France's CNIL exempts audience measurement that meets strict conditions, such as first-party use only, aggregated output and limited lifetimes. The UK's Data (Use and Access) Act 2025 added an exemption for some statistical analytics used to improve a site, as long as visitors are informed and can object. Both are conditional, and neither covers tools that share data with a vendor for its own use. If you want to avoid the question, see cookieless analytics.
Session replay and heatmap tools record far more detail than page counts. Treat them as analytics at a minimum, and mask form fields and personal content.
Marketing cookies
Marketing (or "advertising" or "targeting") cookies track visitors to measure ad conversions, build retargeting audiences or profile interests across sites. Examples:
- Meta Pixel:
_fbp - Google Ads conversion linker:
_gcl_au, and Google's ad-serving cookies ondoubleclick.netsuch asIDE - TikTok Pixel:
_ttp - LinkedIn Insight Tag and other ad platform tags
- Social media embeds and share buttons that track visitors, and video embeds such as YouTube (
VISITOR_INFO1_LIVE,YSC)
Marketing cookies always need consent in the EU and UK. In US states with privacy laws, they're the cookies most likely to count as "selling" or "sharing" personal data, so they're also what the opt-out has to switch off.
Video embeds are a common gray area. Some sites put them in functional and some in marketing. YouTube's cookies are used for advertising and personalization, so marketing is the more cautious choice. Our YouTube embeds guide covers click-to-load options.
Classify by purpose, not by vendor. Google provides necessary-sounding services, analytics and advertising, and each of its cookies goes where its own purpose puts it. One tool can't sit in two categories, so if it serves two purposes, put it in the stricter one.
Other categories you might see
Some banners use more groups. They map to the four above like this:
- Preferences / personalization: functional, unless used for ad targeting.
- Statistics / performance / measurement: analytics.
- Advertising / targeting / social media: marketing.
- Security: usually strictly necessary.
- Unclassified: not a category. It's a to-do list. Investigate each item and assign it before going live.
More categories give visitors finer control, but each extra switch makes the banner harder to understand. Four is enough for most sites.
How to classify any cookie
Work through these questions in order for each cookie or storage item:
- Who sets it, and from which script? Use your scan results or the browser's Network panel to trace it back to a tag or plugin.
- What does the vendor say it does? Check the vendor's cookie documentation. Names like
_gaare well documented. - Would the feature the visitor asked for break without it? If yes, and it's used only for that, it's strictly necessary.
- Is it used for advertising, retargeting or cross-site profiling? If yes, it's marketing, even if it also does other things.
- Does it measure usage? If yes, it's analytics.
- Otherwise, it's functional.
Here's how that works for a live chat widget. Step 1: the scan shows a cookie set by the chat vendor's script on every page. Step 2: the vendor's documentation says the cookie identifies returning visitors so conversations can continue. Step 3: the site works without chat, and the visitor hasn't asked to chat yet, so it isn't strictly necessary. Step 4: the documentation also mentions that visitor data feeds the vendor's marketing tools. If that's enabled, the widget is marketing. If not, it's functional. A cleaner option is to load the widget only when the visitor clicks a "Chat with us" button. The visitor has then requested the service, which strengthens the case that the cookies it needs are necessary.
Record your answer and your reasoning in your cookie inventory. The cookie audit guide includes a spreadsheet layout. When you're unsure between two categories, pick the stricter one. A wrong "necessary" label is the classification error regulators care about most.
Using categories in your banner and policy
Once every cookie has a category:
- The banner shows one switch per category in its preferences panel, all off by default in opt-in regions, with necessary shown as always active.
- Your scripts are tied to their category, so they load only after the visitor allows it. See how to block cookies until consent.
- Your cookie policy lists cookies under the same headings, with purpose and duration. See what to include in a cookie policy.
- Google Consent Mode signals follow the categories: analytics maps to
analytics_storage, and marketing maps toad_storage,ad_user_dataandad_personalization.
PrivacyQuick uses exactly these four categories. Its scanner suggests a category for each cookie it finds, based on a database of known cookies and trackers, and you tag scripts with data-category="analytics", "functional" or "marketing" so they wait for the matching consent.
Unfamiliar terms? The cookie consent glossary defines 60 of them in plain English.
Next steps
- Run a free cookie scan to get a list of what your site sets, with suggested categories.
- Check every "necessary" label against the strict test, and every unclassified item by hand.
- Make sure each category in your banner has a short, honest description.
- Re-check categories when you add a tool or a vendor changes what its script does.
Frequently asked questions
Are analytics cookies strictly necessary?
No. Regulators in the EU and UK don't treat analytics as strictly necessary, because a site works without it. Some, such as France's CNIL, exempt narrowly configured audience measurement, and the UK added a conditional analytics exemption in 2025, but standard Google Analytics setups generally still need consent.
Is the cookie that stores consent a necessary cookie?
Yes. A cookie that remembers a visitor's consent choice is needed to respect that choice, so regulators accept it as strictly necessary. It should store only the choice, not a tracking ID.
What category should a YouTube embed go in?
Usually marketing, because YouTube's cookies are used for advertising and personalization. Some sites use functional instead. Either way it needs consent in the EU and UK, and your cookie policy should match the category you choose.
Do I have to use these exact four categories?
No law prescribes category names. The four-group model is a widely used convention, and what matters legally is that consent is specific: visitors must be able to accept one purpose without accepting the others.
Check your own website in 30 seconds
Our free scanner lists every cookie and tracker your site sets, sorted into categories, before you add a banner.
This guide is general information, not legal advice. Laws and regulator guidance change; check the current rules for your situation or ask a lawyer.