Namorus Namorus

First-party cookie

Glossary · Updated November 27, 2026

A cookie set by, and sent only to, the website you are visiting, on that website's own domain.

A first-party cookie belongs to the site in the address bar. It’s how sites keep you signed in and remember settings, and it’s how a tag on the site recognizes a returning browser.

Browsers treat first-party cookies more kindly than third-party cookies, but not without limits. Safari caps cookies written by scripts at 7 days without a visit as part of its Intelligent Tracking Prevention.1

First party or third party: it’s about the domain

What makes a cookie first-party is whose domain it’s set on, not who wrote the code that set it. A script from another company, running on example.com, can set a cookie on example.com; that cookie is first-party, and it’s sent only to example.com. A cookie set on the other company’s own domain, while you’re on example.com, is third-party, and is the kind browsers now block or partition.

There are two ways:

  • By the server, in a Set-Cookie header on the page’s response. Safari gives these more room than script-set cookies.
  • By a script, through document.cookie. This is how most tags set theirs, because the tag runs in the browser. Safari caps these at 7 days without a visit.1
  • It can recognize the same browser on the same site, across visits and pages.
  • It can’t recognize that browser on another site. A cookie on example.com is invisible to example.org.
  • It can’t recognize the same person in a different browser or on a different device. Each browser has its own cookies.
  • It doesn’t survive the person clearing their cookies, or a private window closing.

That’s why visitor identification needs more than a cookie to name someone. The cookie says “this browser was here before”; something else, such as a sign-in or a form fill, says who the browser belongs to.

Cookies and the law

A first-party cookie holding a random ID is still an identifier. Privacy laws generally expect a site to say what cookies it uses and why, and in some places to ask before setting cookies that aren’t strictly necessary. List every cookie your tools set, with its purpose and how long it lasts. What to tell your visitors.

Local storage, the cookie’s neighbor

Sites can also keep data in the browser’s local storage. It isn’t sent with requests the way a cookie is, but it can hold the same kind of ID. Browsers limit script-written storage in the same way as script-set cookies.1

An example

A visitor opens example.com in Chrome for the first time. The site’s tag finds no cookie, makes a random ID, and stores it as a first-party cookie on example.com. Each page they view is recorded with that ID. Two weeks later they come back in the same browser: the cookie is still there, so the new visit joins the old ones. If they had come back on their phone, or in Safari after more than 7 days without a visit, there would be no cookie, and the visit would look new.

  1. 01First visitThe tag finds no cookie
  2. 02A random ID is storedAs a first-party cookie on the site
  3. 03Each page viewRecorded with that ID
  4. 04Two weeks laterSame browser: the new visit joins the old ones
Figure 1. The example, in four steps.

Why first-party cookies are the honest choice

A first-party cookie only does what the site itself could do: recognize its own returning visitors. It can’t follow anyone across the web. Browsers allow it for that reason, and visitors can see and clear it like any other cookie on the site. Methods that try to do more, such as fingerprinting the device, take away the visitor’s ability to reset. Namorus uses a light form of that, a code made from what the browser reports about itself, to recognize a returning browser on the same home connection; it is never made when the browser sends Global Privacy Control, and an opt-out deletes it.

Questions

Do first-party cookies need consent? That depends on the law where the visitor is and on what the cookie is for. In the US, notice and an opt-out are the usual approach; in the EU and UK, cookies that aren’t strictly necessary generally need consent first.

Can a visitor block them? Yes. Every major browser lets people block or clear cookies for a site, and a private window discards them when it closes.

How long should a cookie last? As long as it’s useful and no longer. A year is common for a visitor ID; browsers may cut it shorter.

In Namorus: the tag sets one first-party cookie, nmr_vid, on the customer’s site — a random ID, asked to last a year — with a copy in local storage as a backup, and none at all when the browser sends Global Privacy Control. A second cookie, nmr_optout, switches the tag off for a browser that opted out on that site. Cookies and storage.

Sources

  1. WebKit — Tracking Prevention in WebKit

See who, and watch their journey.

Add one script. See who's visiting, and watch each visitor's journey across your site. Free for 20–50 US B2B sites during the private beta.

Namorus is in private beta

Enter the beta password to go on to sign in.

No password? Join the beta.