Cookies

An introduction

What is a cookie? If you have a sweet tooth like me you might imagine a round, freshly-baked treat containing chocolate chips:

cookie

Conversely, internet cookies (a.k.a. HTTP cookies) contain data, usually in the form of a text file:

text file

What's in the name? Derived from the term 'magic cookies' (packets of data that have been used to send data over the web since 1979) the term 'cookie' was coined by Lou Montulli and first utilised as an e-commerce solution in 1994. They enabled items in a shopping cart to be saved while you browsed the rest of the site. Cookies quickly gained popularity and began to be used for other purposes.

How do cookies work? When you visit a site, it saves information about you to a document (a cookie) on your hard drive, via HTTP. When you browse or return to a site, saved cookies are sent back to the site's server. Sites mainly use these cookies for the following purposes; updating your preferences, keeping you logged in/remembering items in your cart, or tracking your path through the site.

In essence, cookies leave a sort of bread crumb trail on the web, allowing sites to tailor information specifically for you. They can store all sorts of data, and these are determined by the site's creator. They are website-specific, meaning a cookie created by one website cannot be read by another.

However, one site can contain bits of another, e.g. adverts. If you previously visited, say, an online clothes store, you are likely to have cookies from this site saved on your computer. When you visit a different site on which the clothes store's adverts are embedded, the store is able to access the cookies they saved earlier and dynamically alter the ads to fit your preferences. These cookies are 'third party' cookies. They come from a different domain than the site you are on. Many browsers allow these by default, although there are ways to block them.

What about privacy? After years of ethics debates, in 2011 an EU law was passed stating sites using cookes had to alert visitors, seek permission to store and retrieve data, and draft policies.

See the following examples -

cookies example cookes example

Need more information? Some great resources exist on the privacy and security issues surrounding cookies. This site explains how to opt out of cookies in different browsers. This MDN article covers security and how cookies are sent over HTTP response headers. This article provides very detailed information on how to keep information stored in cookies secure. This site contains a wide breadth of information and helpful tips.

Thanks for reading my short article. I wrote it from scratch with no previous knowledge of cookies. It was fun to learn and I hope to continue increasing my understanding. Please share your own thoughts and research processes!