First-party cookies are cookies that belong to the website a visitor is on, not to another company’s domain. Google Analytics uses them to tell visitors and their sessions apart. In the UK they still fall under the cookie rules: they need consent unless an exception, such as the one for statistics, applies.
First party or third party: what is the difference? #
MDN puts it simply. If the cookie’s domain and scheme match the page in the address bar, it is a first-party cookie. If they do not match, it is a third-party, or cross-site, cookie. The ICO uses the same idea: first party means the website the user is visiting, and third party means any other domain.
| First-party cookie | Third-party cookie | |
|---|---|---|
| Set by | The site in the address bar | Another domain, such as an ad network or a widget |
| Domain and scheme | Match the page | Do not match the page |
| Typical use | Basket, sign-in, language, site analytics | Advertising and tracking across sites |
| Browser defaults | Allowed | Limited by default in Firefox and Safari |
| Needs consent in the UK? | Yes, unless an exception applies | Yes, unless an exception applies |
The ICO adds that these terms have no special meaning in PECR or UK GDPR. What counts is what the cookie stores or reads, and why. A first-party cookie is not exempt from the rules just because it is first party. See PECR and UK GDPR.
What does one look like? #
A server sets a cookie with a Set-Cookie header. One of MDN’s examples is:
Set-Cookie: id=a3fWa; Max-Age=2592000
That cookie lasts 2,592,000 seconds (30 days). MDN explains the main settings:
Secure: sent only over HTTPS. See SSL certificate.HttpOnly: scripts on the page cannot read it.SameSite:Strict,LaxorNonedecide whether it is sent on requests from other sites.Nonealso needsSecure.Domain: if set, the cookie also works on subdomains. If left out, it stays on the server that set it. See subdomain.
MDN also notes cookies are sent with every request, which can slow pages on poor connections, and that a cookie is usually limited to about 4KB.
Which first-party cookies does Google Analytics set? #
Google Analytics 4 sets two first-party cookies: _ga, to distinguish users, and _ga_<container-id>, to keep session state. Both last 2 years by default. Google’s page adds that browsers limit their life when there is no return visit, with a maximum of 400 days for Chrome and 7 days for Safari. So a person who comes back after a few weeks on Safari can count as a new unique visitor. See session.
What are browsers doing about third-party cookies? #
According to MDN, Firefox and Safari both turn on third-party cookie protections by default. Firefox gives third-party cookies a separate cookie jar per site. Chrome blocks third-party cookies by default only in Incognito mode, or when the user chooses to block them. For cross-site cookies that must keep working, MDN describes partitioned cookies (CHIPS) and the Storage Access API.
Do I need consent? #
In the UK, a first-party analytics cookie needs consent unless an exception fits. The ICO lists five exceptions: communication, strictly necessary, statistical purposes, appearance, and emergency assistance. The statistical purposes exception covers cookies used only to measure and improve your site, as long as you explain them clearly and give a simple, free way to object. The ICO sets limits:
- Use it only to improve your own service or website, and for no other purpose.
- A third-party provider may help, but must be a processor, not a joint controller.
- It does not allow you to monitor or track individual visitors.
- It does not apply to purposes related to online advertising.
- Keep individual-level information only as long as you need it. See data retention.
See cookie banner and Consent Mode v2 for UK websites.
Why does it matter for search? #
Search rankings are not counted through your cookies. Google Search Console counts clicks on Google’s side; your analytics counts only browsers that keep its cookie and run its script. That is one reason the two never agree. See Search Console vs analytics. If people decline analytics cookies, your organic traffic in analytics looks lower than the clicks Google reports.
Why does it matter for AI answers? #
Cookies are a browser thing. An AI crawler such as GPTBot or ClaudeBot reads your pages without running your analytics, and an AI agent using an API or MCP never loads a page at all. So cookie-based analytics cannot tell you which AI read you. For that you need server logs or the edge log. See bot traffic in Google Analytics and why analytics numbers are low.
A worked example #
A small shop runs the Cookie Checker on its home page and finds four cookies.
| Cookie | Party | Purpose | Consent? |
|---|---|---|---|
basket |
First | Holds the shopping basket | Strictly necessary exception, if only used for the basket the person asked for |
lang |
First | Remembers the chosen language | Appearance exception may fit |
_ga |
First | Analytics: distinguishes users | Consent, unless the statistical exception and all its limits fit |
| Ad network cookie | Third | Advertising | Consent: the statistical exception does not apply to advertising |
The shop finds _ga is set before anyone clicks the banner. It changes its tag so analytics waits for a choice, then checks again.
Common mistakes #
- Thinking first-party means no consent is needed.
- Setting analytics cookies before the visitor has made a choice.
- A banner with “Accept” but no simple way to object.
- Forgetting that local storage, pixels and fingerprinting are covered too. The ICO names all three as storage and access technologies.
- Session cookies without
SecureandHttpOnly. See HTTP. - Using the statistical exception for a tool that also builds ad audiences.
- Reading analytics totals as every visitor. People who decline, and every bot, are missing.
How to check it #
- See which cookies a page sets before consent with the Cookie Checker. Run it on the home page, a product page and the checkout.
- List every tracker and pixel the page loads with the Tracking Checker. Third-party scripts often set their own cookies.
- Read the raw
Set-Cookieheaders with the HTTP Header Checker, and check related settings with the Security Headers Checker. - Make sure
Securecookies can work: the SSL Certificate Checker confirms HTTPS. - See which analytics and shop software a site runs with the tech stack checker.
- For a UK shop, the UK Shop Compliance Checker looks at unit prices, returns, company details, delivery and the cookie banner. The Online Shop Checker gives a first look at the whole shop. See what a UK business website must show by law.
- Compare your cookie set-up with a rival’s using Compare Two Websites.
- Tag campaign links so you can read them without extra cookies, using the UTM Builder. See UTM parameters.
- Count what cookies miss. The AI Crawler Log Analyser reads a server log in your browser and shows which AI bots read what. Verify an AI Bot checks whether a bot is real. See log file analysis and cookieless analytics.
- In URSY Pro, opening in stages: cookie-free analytics, measurement integrity (did every paid order reach your tracking?) and the UK shop compliance monitor.
Single checks on each tool page: free, no account (2 a day). The full audit: a free account (sign in with an emailed code), 1 a day.
What URSY.com counts #
Our counter sets no cookies and stores nothing on the device. A person is one daily visitor code: a one-way code made from a secret that changes every UTC day, the network address and the browser name. It cannot be turned back, and the same person on two days counts as two visitors. We never keep full IP addresses, never fingerprint and never store query strings. The rules are on our methodology page, and the product is on our cookieless analytics page.
Questions #
Are first-party cookies allowed without consent? #
Only when an exception fits, such as strictly necessary or, with its limits, statistical purposes. Being first party is not an exception by itself.
Can Google Analytics use the statistical exception? #
The ICO says a third-party provider can help only as your processor, only to improve your own site, and never for advertising. Check how your set-up shares data before you rely on it.
Is local storage a cookie? #
No, but the ICO treats web storage, also called local storage, as a storage and access technology. The same rules apply.
What is the difference between a session and a persistent cookie? #
The ICO says session storage generally expires when someone closes the browser or shortly after. Persistent storage stays between browser sessions and can last much longer, like the 2-year _ga cookie. It adds that this is not an absolute rule. Both kinds need consent unless an exception fits.
Will browsers block first-party cookies? #
They limit them. Google says the GA cookie lasts at most 400 days in Chrome and 7 days in Safari without a return visit.
Related words #
- Cookieless analytics
- Server logs
- Cookie banner
- PECR
- UK GDPR
- Consent Mode v2
- Server-side tracking
- Google Analytics 4
- Unique visitor
Sources #
- Analytics Help: [GA4] Cookie usage on websites, checked 24 November 2026
- MDN: Third-party cookies, checked 24 November 2026
- MDN: Using HTTP cookies, checked 24 November 2026
- ICO: What are storage and access technologies?, checked 24 November 2026
- ICO: What are the exceptions?, checked 24 November 2026
- URSY.com: How we count (methodology), checked 24 November 2026
Updated 24 November 2026 by URSY.com.
Cite this page: What are first-party cookies?. URSY. Updated 26 November 2026. https://ursy.com/wiki/first-party-cookies/ · Section links
Tools for this
- LiveTracking Checkerevery tracker and pixel a page loadsRun the check →
- LiveKeyword Clustering ToolRun the check →
- LiveCompare Two Websitesour checks side by side, winner per row (box on the home page)Run the check →
- Coming soonURSY Authority 0-100See the tool →
- ProPrompt trackerYour chosen questions asked to AI every day; are you in the answer?In URSY Pro →
- ProAI share of voiceYou vs rivals across all tracked promptsIn URSY Pro →
- ProCookie-free analyticsVisits, pages, sources, without cookiesIn URSY Pro →