What are cookies used for?
Web browsers keep cookies in a special file on users’ devices. For example, the Google Chrome browser keeps all cookies in a file called “Cookies.” Chrome users can see the cookies saved by the browser by opening the developer tools, clicking the “Application” tab, and then clicking on “Cookies” in the menu on the left side.
User sessions
Cookies help link what a person does on a website to that person. A session cookie has a special code made of letters and numbers that connect a person’s visit to their data and what they see on the site. For example, Jane has an account on a shopping website. She logs into her account from the main page. When she logs in, the website’s server makes a session cookie and sends it to Jane’s browser. This cookie tells the website to show Jane’s account information, so the main page now says, “Welcome, Jane.” Then Jane clicks on a product page showing a pair of jeans. When Jane’s web browser asks the website for the jeans page, it sends Jane’s session cookie with the request. Because the website has this cookie, it knows the user is Jane, and she does not have to log in again when the new page loads.
Personalization
Cookies help a website remember what a user does or likes so it can improve the user’s visit. If Jane logs out of the shopping website, her name can be kept in a cookie and sent to her web browser. The next time she opens the website, the web browser sends this cookie to the web server, asking Jane to log in with the name she used before.
Tracking
Some cookies keep track of which websites users visit. This information is sent to the server that made the cookie the next time the browser loads something from that server. With tracking cookies from other companies, this happens whenever the browser opens a website that uses that tracking service. If Jane has visited a website that sent her browser a tracking cookie, the cookie may note that Jane is now looking at a page for jeans. Next time Jane opens a website that uses this tracking service, she might see ads for jeans.