What is a Cookie?

A cookie is a piece of identifying data, typically created by a web server. A website sends a cookie to a visitor's browser and stores it on a visitor's computer either temporarily (for that visit session only) or permanently on the hard disk (or until the visitor deletes them).

Temporarily stored cookies are called session cookies. Cookies stored on the hard disk are called persistent cookies.

Persistent cookies can identify a visitor as a new or returning visitor by storing a value that uniquely identifies each visitor. If a visitor has been to the site before, a cookie is sent to the web server with the request for a particular page. The web server checks for the presence of a cookie in the request and if no cookie is detected, the web server generates the cookie and sends it with the response to the visitor's browser. When the visitor returns, the cookie is included in the request, the web server detects the cookie and recognizes the visitor as a returning visitor. The web server then writes the cookie to the log file in the cs(Cookie) field.