DEV Community

Cover image for          Who wants a cookie? !
Khalif Cooper
Khalif Cooper

Posted on

Who wants a cookie? !

  • What are cookies?!
  • Why are they so darn important?
  • And why do I need to know about them?
  • Are cookies bad or good?

In this article, I am going to explain what you need to know about cookies.Who, uses cookies; What are they used for and why we use cookies. I will show you the good, the bad, and the ugly.

What is a cookie?

So, What is a cookie? Well, my friend, think of a cookie as a small digital box or file that collects and stores information. So, let's say if you visit facebook.com or gmail.com to login or to create an account; When you make that action, the site triggers a cookie, file that collects and stores information, to captures your login information. The might include a unique identifier, username and password, as well as some other info we will talk about later in the article.

So, next time, you go to facebook.com or gmail.com to login, the site will read the cookie from the last time you visited the site. That same cookie will be read and see your login information then you will be able to login, without providing any information again. This is how users are able to login automatically into a Instagram, Gmail, Facebook, and Outlook without logging in.

This sounds awesome! so, what is the bad news..give it to me. So, there are two types of cookies, and by your personal preference one of them can bad. You have first party cookies and third party cookies.

First Party Cookies

A First Party Cookies is a cookie that collect information for the particular site you are on, lets' say Twitch. Twitch will collect information to improve performance speed and other things so next time you visit their site you have a better experience.

Third Party Cookies

A Third Party Party Cookie is a cookie created by domains and not the website. They are scripts that are place on other sites that are unrelated to the particular website that you are on. Like, first party cookies they also that collect information from you. And if you don't want to be track by random sites, well that would be where the bad part would come in. Although, third party cookies help other businesses for marketing purposes.

So, this was an introduction to get you started on what cookies are? Why I need to know about them? etc.. I hope this article helped giving you so insight on cookies. Below I will drop some resources as well, if you want to see how to implement cookies in Javascript.

Resources
https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie

https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/cookies

Top comments (0)