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 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.