What are cookies
Let's try to understand what cookies are and why the European Union issued two directives about them.

Contents
- What are cookies?
- What are cookies for?
- Types of cookies
- Why are there regulations about cookies?
- Disclaimer
What are cookies?
Cookies are pieces of information placed on your browser when you visit a website or use a social network with your PC, smartphone or tablet.
Each cookie contains various data such as, for example, the name of the server it comes from, a numeric identifier, etc.
Cookies can remain in the system for the duration of a session (that is, until you close the browser used to surf the web) or for long periods, and they can contain a unique identification code.
From the website of the Italian Data Protection Authority (translated)
What are cookies for?
So we can say that cookies are pieces of information that a web server sends to your browser.
Originally they were saved as text files; in general that is no longer true, but for our purposes it doesn't matter exactly where and in what format this data is stored.
The information sent to the browser is associated with the site that sends it through its domain. Every time the browser connects to the site, it sends the cookie back to the server.
In fact, the main way websites use cookies is precisely to recognise returning users, or users who are allowed into restricted areas.
That is exactly why cookies were invented: to recognise a user's device and give it access to restricted areas of the site, or to remember the user's choices.
Applications such as e-commerce would not be possible without cookies.
"Cookies are a particular kind of magic cookie (a sort of identification token) and are used by server-side web applications to store and retrieve long-term information on the client side. […] The first use of cookies in HTTP dates back to 1994, when they were used to check whether readers of the Netscape website had already visited it before. In 1995 cookie handling was built into Internet Explorer 2. […]"
From the Italian Wikipedia (translated); see also HTTP cookie
Types of cookies
Taking a cue from gdpr.eu, we can classify cookies into the following categories.
Duration
- Session cookies are sent by the web server with the instruction that the browser should delete them as soon as it is closed.
- Persistent cookies are sent by the web server with an expiry date, so once that date has passed they expire and the browser can delete them.
The classification above looks at cookies from a strictly technical point of view.
Origin
- First-party cookies are set by the site you are visiting.
- Third-party cookies are set through the site you are visiting and can be used for various purposes, such as analytics or advertising tools.
Purpose
- Strictly necessary cookies are essential for browsing the site and using the features it provides, for example accessing restricted areas. The cookies that let shops keep the items in your cart while you carry on shopping are an example of strictly necessary cookies. They are generally first-party cookies. While you don't need to ask permission to set these cookies, you do need to explain to users why they are set and what they are used for.
- Preference cookies, also known as "functionality cookies", let the site remember the choices you have made, such as your preferred language, which country you want the weather forecast for, or your username and password so you can log in automatically.
- Statistics cookies, also known as "performance cookies", collect information about how you use the site, such as which pages you visited and which links you clicked. None of this information can be used to identify you; its only purpose is to improve the site's features. They include cookies from third-party analytics services, as long as the cookies are used exclusively by the owner of the site being visited.
- Marketing cookies track your online activity to help advertising platforms show you more relevant ads or limit how many times you see an ad. These cookies share the information they collect between different organisations. They are persistent cookies and almost always come from third parties.
Why are there regulations about cookies?
Although cookies were originally used only for technical or functional purposes, over time the companies advertising on the internet realised they could track users' behaviour and collect information about them to show more effective ads.
Cookies can store a large amount of data, enough to potentially identify you without your consent. They are the main tool advertisers use to track your online activity so they can target you with highly specific ads.
Given the amount of data cookies can hold, in certain circumstances they can be considered personal data and are therefore subject to the GDPR.
Disclaimer
I wrote this article while gathering information to understand how to implement an effective cookie solution and how cookies relate to privacy, so as to build more appropriate and effective solutions.
This article is for information purposes only.
I cannot be held responsible for any damage resulting from the use of the information it contains.
For any need beyond general understanding, you should consult an advisor or one of the companies specialising in online privacy and data management, such as iubenda.