Skip to content
Privacy and compliance

What is a first-party cookie?

3 min read · Updated · By the Reveata team

Short answerA first-party cookie is a small piece of data stored by the website shown in the address bar, on that site's own domain. Only that site can read it, which is why it is used for sign-in sessions, shopping baskets and first-party analytics.

Child's hands opening a teddy bear cookie jar
Photo by Lucas on Unsplash

The words "first-party" and "third-party" describe whose domain the cookie belongs to, compared with the page you are on. If you are on example.com and the cookie is set for example.com, it is first-party. If the page loads something from ads.othercompany.net that sets a cookie for that domain, it is a third-party cookie.

There are two ways:

How Example Notes
By the server, in a Set-Cookie header A sign-in session Can be marked HttpOnly, so scripts cannot read it
By a script on the page, through document.cookie An analytics visitor id Readable by scripts on the same site

The difference matters in Safari. WebKit's tracking prevention (opens in a new tab) deletes cookies created in JavaScript after 7 days without user interaction, so a first-party analytics cookie set by a script can vanish sooner than its stated lifetime. See Intelligent Tracking Prevention.

What first-party cookies are used for

  • Keeping people signed in.
  • Remembering a basket, a language or a theme.
  • Recognising a returning visitor in analytics.
  • Remembering a consent choice.

Not by itself. A cookie on example.com is sent only to example.com. Cross-site tracking needs a third party present on many sites, or identifiers passed in links. That is why browsers have restricted third-party cookies much more than first-party ones.

The EU rule in the ePrivacy Directive does not care whose domain the cookie is on. It asks whether the cookie is strictly necessary for a service the visitor requested. A sign-in cookie usually is; an analytics cookie usually is not. This is general information, not legal advice.

How Reveata uses first-party cookies

By default the Reveata script sets two first-party cookies on your own domain:

Name Lifetime Contents
_dt_v Up to 400 days A random visitor id and a visit counter
_dt_s 30 minutes, renewed on activity A random session id and the time of the last activity

They contain no personal details and are never shared between websites. The script writes them on the broadest domain the browser accepts, so www, app and blog subdomains share one visitor (Track subdomains). Because the visitor id is stable, Reveata can pass it into your checkout and credit the payment to the visit that brought the customer.

If you would rather set no cookies, switch on cookieless mode. Nothing is then stored in the browser, at the cost of counting a returning visitor as new on another day. Full details are in Privacy, cookies and cookieless mode.

Frequently asked questions

Are first-party cookies blocked by browsers?

Browsers do not block first-party cookies by default, but Safari limits how long script-set ones live, and visitors can block or clear any cookies in their settings. Some privacy extensions also block known analytics scripts, whatever cookies they use.

Is a first-party cookie safer than a third-party one?

It reveals less, because only the site you are on can read it. It is still data about your visit, so it belongs in the site's cookie policy.

Can two websites share a first-party cookie?

Not across different root domains. Subdomains of one domain can share a cookie set on the parent domain. To follow one visitor across two domains, Reveata uses cross-domain tracking, which passes a short-lived id in the link instead.

See it with your own numbersReveata ties every visit and sale to the source that brought it. Add your website in a minute.
Get started
Was this page useful?
GlossaryWhat is a third-party cookie?A third-party cookie is a cookie set by a domain other than the one in the address bar, usually by an embedded ad, widget or tracking script. Because the same third party is present on many sites, its cookie can recognise one browser across all of them.GlossaryWhat is Intelligent Tracking Prevention (ITP)?Intelligent Tracking Prevention (ITP) is a set of privacy protections in WebKit, the engine behind Safari, that blocks third-party cookies and limits how long cookies and storage created by scripts can last, to stop websites and trackers following people across the web.GlossaryWhat is cookieless tracking?Cookieless tracking is website measurement that stores nothing in the visitor's browser: no cookies, no local storage. Visits are counted from what each request already carries, usually combined into a short-lived anonymous id on the server.GlossaryWhat is cookie consent?Cookie consent is the permission a website asks a visitor for before it stores or reads non-essential cookies, or similar data, on their device. Under EU and UK rules it must be given freely, clearly and before the cookies are set, and it must be as easy to refuse as to accept.GlossaryWhat is a cookie banner?A cookie banner is the pop-up or bar a website shows to tell visitors which cookies and similar technologies it uses and to collect their choice, so that non-essential cookies are only set after the visitor agrees.GlossaryWhat is a data controller?A data controller is the organisation that decides why and how personal data is processed. A data processor is a separate organisation that processes the data on the controller's behalf and only on its instructions, such as an analytics or email provider.