---
title: "What are first-party cookies?"
description: "Cookies set by the website a visitor is on, not another company's domain. In the UK they still need consent unless an exception applies."
url: https://ursy.com/wiki/first-party-cookies/
updated: 2026-11-26T15:48:11+00:00
publisher: URSY (https://ursy.com/)
cite: Name URSY and link https://ursy.com/wiki/first-party-cookies/
---

# What are first-party cookies?

> Cookies set by the website a visitor is on, not another company's domain. In the UK they still need consent unless an exception applies.

**First-party [cookies](https://ursy.com/wiki/cookie/) are cookies that belong to the website a visitor is on, not to another company’s domain.** [Google](https://ursy.com/wiki/google/) Analytics uses them to [tell visitors and their sessions apart](https://support.google.com/analytics/answer/11397207). 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? {#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](https://developer.mozilla.org/en-US/docs/Web/Privacy/Guides/Third-party_cookies). 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](https://ico.org.uk/for-organisations/direct-marketing-and-privacy-and-electronic-communications/guidance-on-the-use-of-storage-and-access-technologies/what-are-storage-and-access-technologies/). 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](https://ursy.com/wiki/pecr/) and [UK GDPR](https://ursy.com/wiki/uk-gdpr/).

## What does one look like? {#what-does-one-look-like}

A server sets a cookie with a `Set-Cookie` header. One of [MDN’s examples](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Cookies) 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](https://ursy.com/wiki/ssl-certificate/).
- `HttpOnly`: scripts on the page cannot read it.
- `SameSite`: `Strict`, `Lax` or `None` decide whether it is sent on requests from other sites. `None` also needs `Secure`.
- `Domain`: if set, the cookie also works on subdomains. If left out, it stays on the server that set it. See [subdomain](https://ursy.com/wiki/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? {#which-first-party-cookies-does-google-analytics-set}

[Google Analytics 4](https://ursy.com/wiki/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](https://ursy.com/wiki/unique-visitor/). See [session](https://ursy.com/wiki/session/).

## What are browsers doing about third-party cookies? {#what-are-browsers-doing-about-third-party-cookies}

According to [MDN](https://developer.mozilla.org/en-US/docs/Web/Privacy/Guides/Third-party_cookies), 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? {#do-i-need-consent}

In the UK, a first-party analytics cookie needs consent unless an exception fits. The ICO lists [five exceptions](https://ico.org.uk/for-organisations/direct-marketing-and-privacy-and-electronic-communications/guidance-on-the-use-of-storage-and-access-technologies/what-are-the-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](https://ursy.com/wiki/data-retention/).

See [cookie banner](https://ursy.com/wiki/cookie-banner/) and [Consent Mode v2 for UK websites](https://ursy.com/wiki/consent-mode-v2-for-uk-websites/).

## Why does it matter for search? {#why-does-it-matter-for-search}

Search rankings are not counted through your cookies. [Google Search Console](https://ursy.com/wiki/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](https://ursy.com/wiki/search-console-vs-analytics/). If people decline analytics cookies, your [organic traffic](https://ursy.com/wiki/organic-traffic/) in analytics looks lower than the clicks Google reports.

## Why does it matter for AI answers? {#why-does-it-matter-for-ai-answers}

Cookies are a browser thing. An [AI crawler](https://ursy.com/wiki/ai-crawler/) such as [GPTBot](https://ursy.com/wiki/gptbot/) or [ClaudeBot](https://ursy.com/wiki/claudebot/) reads your pages without running your analytics, and an [AI agent](https://ursy.com/wiki/ai-agent/) using an API or [MCP](https://ursy.com/wiki/mcp/) never loads a page at all. So cookie-based analytics cannot tell you which AI read you. For that you need [server logs](https://ursy.com/wiki/server-logs/) or the edge log. See [bot traffic in Google Analytics](https://ursy.com/wiki/bot-traffic-in-google-analytics/) and [why analytics numbers are low](https://ursy.com/wiki/why-analytics-numbers-are-low/).

## A worked example {#a-worked-example}

A small shop runs the [Cookie Checker](https://ursy.com/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 {#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 `Secure` and `HttpOnly`. See [HTTP](https://ursy.com/wiki/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](https://ursy.com/wiki/bot-web-robot/), are missing.

## How to check it {#how-to-check-it}

1. See which cookies a page sets before consent with the [Cookie Checker](https://ursy.com/cookie-checker/). Run it on the home page, a product page and the checkout.
2. List every tracker and pixel the page loads with the [Tracking Checker](https://ursy.com/tracking-checker/). Third-party scripts often set their own cookies.
3. Read the raw `Set-Cookie` headers with the [HTTP Header Checker](https://ursy.com/http-header-checker/), and check related settings with the [Security Headers Checker](https://ursy.com/security-headers-checker/).
4. Make sure `Secure` cookies can work: the [SSL Certificate Checker](https://ursy.com/ssl-checker/) confirms HTTPS.
5. See which analytics and shop software a site runs with the [tech stack checker](https://ursy.com/tech-stack-checker/).
6. For a UK shop, the [UK Shop Compliance Checker](https://ursy.com/uk-shop-compliance-checker/) looks at unit prices, returns, company details, delivery and the cookie banner. The [Online Shop Checker](https://ursy.com/online-shop-checker/) gives a first look at the whole shop. See [what a UK business website must show by law](https://ursy.com/wiki/what-must-a-uk-business-website-show-by-law/).
7. Compare your cookie set-up with a rival’s using [Compare Two Websites](https://ursy.com/compare-websites/).
8. Tag campaign links so you can read them without extra cookies, using the [UTM Builder](https://ursy.com/webmaster-tools/utm-builder/). See [UTM parameters](https://ursy.com/wiki/utm-parameters/).
9. Count what cookies miss. The [AI Crawler Log Analyser](https://ursy.com/ai-crawler-log-analyzer/) reads a server log in your browser and shows which AI bots read what. [Verify an AI Bot](https://ursy.com/verify-ai-bot/) checks whether a bot is real. See [log file analysis](https://ursy.com/wiki/log-file-analysis/) and [cookieless analytics](https://ursy.com/wiki/cookieless-analytics/).
10. In URSY Pro, opening in stages: [cookie-free analytics](https://ursy.com/pro/cookie-free-analytics/), [measurement integrity](https://ursy.com/pro/measurement-integrity/) (did every paid order reach your tracking?) and the [UK shop compliance monitor](https://ursy.com/pro/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 {#what-ursy-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](https://ursy.com/wiki/ip-address/), never fingerprint and never store query strings. The rules are on our [methodology](https://ursy.com/methodology/) page, and the product is on our [cookieless analytics](https://ursy.com/cookieless-analytics/) page.

## Questions {#questions}

### Are first-party cookies allowed without consent? {#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? {#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? {#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? {#what-is-the-difference-between-a-session-and-a-persistent-co}

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? {#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 {#related-words}

- [Cookieless analytics](https://ursy.com/wiki/cookieless-analytics/)
- [Server logs](https://ursy.com/wiki/server-logs/)
- [Cookie banner](https://ursy.com/wiki/cookie-banner/)
- [PECR](https://ursy.com/wiki/pecr/)
- [UK GDPR](https://ursy.com/wiki/uk-gdpr/)
- [Consent Mode v2](https://ursy.com/wiki/consent-mode-v2/)
- [Server-side tracking](https://ursy.com/wiki/server-side-tracking/)
- [Google Analytics 4](https://ursy.com/wiki/google-analytics-4/)
- [Unique visitor](https://ursy.com/wiki/unique-visitor/)

## Sources {#sources}

- [Analytics Help: [GA4] Cookie usage on websites](https://support.google.com/analytics/answer/11397207), checked 24 November 2026
- [MDN: Third-party cookies](https://developer.mozilla.org/en-US/docs/Web/Privacy/Guides/Third-party_cookies), checked 24 November 2026
- [MDN: Using HTTP cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Cookies), checked 24 November 2026
- [ICO: What are storage and access technologies?](https://ico.org.uk/for-organisations/direct-marketing-and-privacy-and-electronic-communications/guidance-on-the-use-of-storage-and-access-technologies/what-are-storage-and-access-technologies/), checked 24 November 2026
- [ICO: What are the exceptions?](https://ico.org.uk/for-organisations/direct-marketing-and-privacy-and-electronic-communications/guidance-on-the-use-of-storage-and-access-technologies/what-are-the-exceptions/), checked 24 November 2026
- [URSY.com: How we count (methodology)](https://ursy.com/methodology/), checked 24 November 2026

*Updated 24 November 2026 by URSY.com.*
