What is a cookie and how does it work technically?
HTTP is a stateless protocol: every request the browser sends to a server stands on its own, with no memory of the one before it. Cookies exist to fix that. When you visit a site, the server can include a Set-Cookie header in its response, a name-value pair with an optional expiration date, domain, and security attributes.
The browser stores that small file and sends it back automatically in the Cookie header on every later request to the same domain. That is how an online store remembers what is in your cart between pages, and how a site keeps you logged in without asking for your password on every click. RFC 6265, the technical standard behind it, describes cookies as a state management mechanism layered on top of a protocol that has none of its own.
Not every cookie serves the same purpose. Some are required for the site to work at all, like session or cart cookies. Others just store preferences such as language or currency, and some exist purely to measure traffic or serve ads. That last group is what technical SEO cares about most, since it decides which scripts load before or after the user has given consent.
