A cookie is a small piece of data stored by a web browser at the request of a web site, for the purpose of conveying state between related web page requests. Common uses of cookies include:
- session tracking;
- recording user preferences; and
- web analytics.
Cookies held by the browser can be accessed by the server using the HTTP
Set-Cookie headers. For CGI scripts they are passed in the environment variable
HTTP_COOKIE. Cookies are also accessible to code running locally on the web browser if a suitable API has been provided for the language in question. Examples include