What are Cookies Used For

In the era of the internet, who doesn't know about cookies? You must have seen a pop-up on almost every website asking you to accept cookies. But what are cookies? What are cookies used for? Why do websites ask you to accept cookies? Let's find out.

What are Cookies?

Cookies are nothing but a small piece of data that is stored on the user's computer by the web browser. Cookies are created by the websites that you visit.

Cookies are used for various purposes like identifying the user, tracking the user's activity on the website, etc.

In this article, you will learn the use of cookies in detail.

Use of Cookies

Before understanding the use of cookies, think of these situations:

Suppose you visit a website and you log in to your account and do some activity on the website. Then you close the browser and visit the website again after some time and again you have to log in to your account. Every time you visit the website you have to log in to your account. Isn't it annoying?

Or think of a situation where you are shopping on an e-commerce website and you add some items to your cart and then you close the browser. After some time you visit the website again and you find that your cart is empty. Now you have lost all the items that you added to your cart. Isn't it frustrating?

Well, this is where cookies come into the picture. Cookies store the user's information on the user's computer. So that when the user revisits the website, the website can retrieve the user's information from the cookies and use it.

This improves the user experience on the website.

what are cookies used for
Use of Cookies

Here are the uses of cookies in detail:

Types of Cookies

Cookies can be broadly classified into two types:

Session Cookies Persistent Cookies
Temporary Storage Lomg Term Storage
Deleted when the user closes the browser Deleted after the expiration date
Stores the user's information in the browser's memory Stores the user's information on the user's computer

Alternatives to Cookies

As a concern for privacy and data security the question arises, are cookies the only way to store user's information?

Well, the answer is no. Some innovative alternatives to cookies are developing creating a balance between user privacy and user experience.

Server-side tagging is one such alternative to cookies. It reduces reliance on cookies and instead uses a server-side database to store user's information.

Federated Learning of Cohorts (FLoC) is Google's initiative for similar interest based advertising without using cookies.


Cookies are mainly used to enhance user experience and improve the website. But cookies can also be used to track the user's activity on the website. So, it is important to understand the use of cookies and how they work.

Hope you understand the use of cookies by now.

Happy Learning!