What Is A Cookie?

What Is A Cookie

Date First Published: 12th July 2022

Topic: Web Design & Development

Subtopic: Web Technologies

Article Type: Computer Terms & Definitions

Difficulty: Medium

Difficulty Level: 4/10

Learn more about what a cookie is in this article.

A cookie is a small file stored on a computer used to remember certain information. For example, online shopping websites use cookies to keep track of the items in a user's shopping cart as they are browsing the website. Without these cookies, the shopping cart would reset back to 0 items every time the page is refreshed or a user visits another webpage.

Note: Info Icon

Cookies are only stored on the user's local computer in the web browsers. They are not stored on the web server.

What Information Can Cookies Store?

Cookies are used to store almost any information. The information they can store could include:

  • Login information for a certain website, such as a username and a password. Some websites may only save the username. When ticking a box that says 'Remember me', the website will produce a login cookie after successfully signing in.
  • Preferences for a website, such as dark mode, preferred language, and font size. For example, when the visitor turns dark mode on, the website will produce a cookie that contains the stored information so that dark mode remains on, even when the user visits other webpages or reloads the webpage.
  • Tracking information for personalisation – Cookies can be used for a website to generate personalised ads or products. For example, a visitor may view certain items or parts of a site and cookies can use this data to produce targeted ads. Shopping websites may use cookies to suggest other products that they might like based on previously viewed items.
  • Unique IDs - Each cookie has its own unique ID. Cookies can be used by website owners to track the number of unique visitors on their website. For example, if the same visitor viewed three webpages, the cookie would count this as one unique visit.

Types Of Cookies

Session cookies

These types of cookies only last for a session and exist in temporary memory (RAM) whilst the user browses a website. They are never written to a HDD. The server creates a ‘session ID’ cookie which is a randomly generated number that temporarily stores the session cookie. After the session ends, they are deleted. An example of a session cookie is a shopping cart on an online shopping website. The session cookie will remember the user's selection so that the shopping cart has the items they selected when they checkout.

Persistent cookies

These types of cookies stay on the computer forever until the expiration date and are automatically deleted when that date is reached unless they are manually deleted by the user. An example of a persistent cookie is a cookie that stores login information for a certain website. This cookie will remain on the computer and be deleted when it reaches its expiration date.

First-party cookies

These types of cookies are directly created by the website the visitor is using. They do not share information with other websites or advertising partners and cannot track users on a different website.

Third-party cookies

These types of cookies are created on a website by a third party, which refers to a source other than the website the visitor is using. They are placed on a website by adding scripts or tags. Third-party cookies can allow advertisers to track a visitor’s browsing history across the internet on multiple sites, which is often viewed as a privacy risk.

Supercookies

Also known as zombie cookies or evercookies, these types of cookies are from a third party and are permanently installed on visitor’s computers. They automatically reappear after they have been deleted by the user, making them extremely difficult to remove. They are often used to track or ban individual users.

Allowing, Blocking, and Removing Cookies

By default, all web browsers allow some cookies. Without any cookies, websites may fail to function properly and would make the user browsing experience much more difficult. Disabling all cookies may break some functionality on websites, such as login pages, and online shopping websites. In order to prevent tracking, most web browsers do not allow third party cookies by default. The settings can be customised to allow or block certain types of cookies. Cookies can be removed in the settings of the web browser. Removing cookies will reset all user preferences, tracking, auto-filled details, and personalisation. It is a good idea to clear cookies once a month to speed up web browsing.

Security Risks of Cookies

Cookies are simply plaintext files and cannot infect computers with viruses and malware. They are not executable. However, some cyberattacks, such as cross-site scripting (XSS) attacks can steal cookies and gain access to user’s browsing sessions without a username or password as long as that cookie hasn’t expired or changed.

Why Do Websites Show Notifications About Cookies

Most internet users are familiar with those popups about cookies that require them to click to continue browsing the page or notification boxes that appear at the top asking users to accept cookies. Cookies capable of collecting personally identifiable information need to get consent from users in order to place the cookies on their device. The cookie notifications are reflective of an EU data privacy protection law, called GDPR (General Data Protection Regulation). The notifications must allow users to opt in and out of cookies and notify users of which information is collected if they accept cookies.

Cookies can become a privacy risk as they can reveal information about the user’s browsing history. Advertisers can view the cookies to find out where the user has been, what their interests are, and more. They can then use this information to show personalised ads. GDPR was designed to protect user’s privacy by making consumers aware of what information is collected about them and allowing them to opt out.

History

In 1994, the first website cookie was invented by a programmer, called Lou Montulli at Netscape Communications. He was creating an online store for a company that said that their servers were getting overfilled from storing each user’s individual shopping cart data whilst they were browsing the store.

Lou Montulli then tried to find a method of storing each user’s shopping cart data on their own computer in order to save server storage space for the company. He then thought back to an old computing token which was called the magic cookie. It was used to identify when a user logs into a system. He recreated this concept for web browsing and invented the modern-day cookie.


Feedback

  • Is there anything that you disagree with on this page?
  • Are there any spelling, grammatical, or punctuation errors on this page?
  • Are there any broken links or design errors on this page?

If so, it is important that you tell me as soon as possible on this page.