Cookies are text files retained on computers by browsers containing various information in regards to a specific website visit. Another way to think of this is that a cookie is a message given to a web browser from a web server that is then sent back to the web server whenever the browser requests a page from it. Cookies are used to identify users, store shopping cart information, and prepare customized web pages that utilize user information. The cookie may be used to remember a username, for example, so that the name will auto-fill on the user’s next visit. Cookies may be disabled, or cookie options customized, due to privacy concerns and the risk of some cookies being used as spyware. It should be noted that because cookies are not executable files, they cannot be considered viruses as they do not have the ability to replicate.

Session cookies last only for as long as a user is on a website; they expire after the browser window is closed or the session times out. Persistent cookies (also known as tracking cookies) remain active for a period of time on a user’s machine and are used whenever the website is accessed. Secure cookies are used when accessing a website via HTTPS and are encrypted for greater safety.

Good Uses for Cookies

As we’ve seen, cookies have a number of very important uses. The web wouldn’t be what it is without them today.

  • Cookies store your login state. Without them, you wouldn’t be able to log into websites. Websites use cookies to remember and identify you.
  • Cookies store preferences on websites. You couldn’t change settings and have them persist between page loads without cookies.
  • Cookies allow websites to provide personalized content. For example, if you’re shopping on Amazon, Amazon can remember the products you’ve browsed and recommend similar products – even if you’re not logged in.

“Bad” Uses for Cookies

However, cookies can also be used for more questionable purposes. Advertising and tracking networks use tracking cookies to track you across the web. When you visit website that uses scripts from an advertising network, that network can set a cookie in your browser. When you visit another website that uses tracking scripts from the same network, the advertising network can check the value of your cookie – it knows the same person visited both websites. In this way, the advertising networks track you across the web.

This information is used to target ads to you – for example, if you search for car insurance and later visit a news website, you may see advertisements for car insurance on the news website. The advertisements may not be related to the website you’re currently on, but they will be related to the websites you were visiting before. Depending on the advertising network, you may be able to opt out of this – as with the Google Ads Preferences page, which also shows the advertising categories you’ve been assigned by Google based on the websites you’ve been tracked across.

Tracking networks can also use the data for other purposes – for example, selling aggregated browsing data to others.