How a cookie works
The server creates the cookie with a Set-Cookie header; the browser stores it and sends it back in the Cookie header of later requests. That is how a website, stateless by nature, recognizes a visitor from one page to the next.
- Session cookie: no expiry date, deleted when the browsing session ends.
- Persistent cookie: deleted at the Expires date or after the Max-Age duration.
- Secure: only sent over HTTPS. HttpOnly: unreadable by JavaScript, which helps mitigate XSS attacks.
- SameSite: Strict, Lax (the default) or None, which requires Secure, to control cross-site sending.
- First-party or third-party: set by the site you visit, or by external content embedded in the page. Several browsers already block third-party cookies by default.
What US and EU rules require
The US has no federal cookie consent law. State privacy laws such as California's CCPA follow an opt-out model: if cookies are used to share data for cross-context behavioral advertising, covered businesses must disclose it, offer a Do Not Sell or Share option and honor Global Privacy Control signals. Several other states have adopted similar rights.
Visitors from the EU are different. Under the ePrivacy rules and the GDPR, non-essential cookies require prior, freely given, specific, informed and unambiguous consent, with declining as easy as accepting. If you sell to Europe, a consent banner is not optional.
Auditing your site's cookies
- Open a private window and your browser's developer tools, under Application then Cookies.
- Load the page without touching the banner and list the cookies already set.
- Check which ones are advertising cookies and whether your privacy policy discloses them.
- Test the opt-out: decline or send a GPC signal, reload, and confirm no new ad cookies are set.
