What are cookies and why should we use them on our website

For several years now, when we enter a page or portal, we see a sign asking for permission to install cookies. Find out what they are and what they are for.

Editorial Team 15 February 2022

For several years now, when we enter a page or portal, we see a sign asking for permission to install cookies; This decision almost always goes unnoticed by users and the conditions imposed by the websites with the information we offer them are not read.

Cookies are files sent to the browser, to store user activities and behaviors on a Web page during their stay on the site; for example, storage of authentication data so that the user does not have to identify himself each time he visits the page. These types of files can be used in many ways, helping us to understand the habits of our customers.

Cookie Classes

Although as such there are no cookie classes defined in the IETF recommendations (6265) we can group them into the following classes.

  • By creator; defines who created the cookie, it can be us or a third party on our page.
    • Own cookies
    • Third-party cookies
    < /li>
  • By length of stay. cookies may have an expiration time; for example, logins to bank accounts which expire in a few minutes, or can be persistent as authorizations to a computer to access some types of account (bank, email, etc.).
    • Persistent
    • By login
  • Use purpose. It is one of the most common uses, the information of pages visited in the portal can be stored in order to offer products of interest, they are also used to store information such as language data and configurations preferred by users in our portal.< ul>
  • Advertising
  • Navigation analysis
  • Personalization

What can store a cookie

Cookies collect browsing information; This does not mean that they can access files within the user's computer, or from sessions of other pages; some examples of data that we can store are:

  • IP address of the visitor
  • Browsing habits within our page
  • Username and password to access our page in case we have any authentication service users.
  • Data entered by the user on our page.

The information collected when visiting our page must remain secure, so it is important that if we start using cookies on our page we have security protocols in mind so as not to leave this information vulnerable.

How cookies can help us on our page

Cookies can be very useful, especially to register the interest that our visitors have in our goods or services; We can store the time spent in any of the products we offer, the pages visited within our site, the IP from which the connection was made, among others.

By storing cookies, in a future entry of those who previously accessed our page, we can send you the content based on the information captured during your last visit with the data that may interest you, defining a sales target.< /p>

We can create login cookies so that users do not have to authenticate each time they visit our website, storing data such as language and those that we can use to improve the user experience on our page; storage of information such as products added to a shopping cart among others.

Implementation of Cookies

In order to implement cookies, media knowledge is required - advanced in programming; The recommendations for creating cookies, headers, examples, security, among others, can be found in the public documents of the IETF organization.


Cookies can be implemented in any programming language, the first thing we must do is the use that we will give to the cookies that we implement; Depending on the type of cookie, the programming is done in the language of our preference.


For the PHP language we can find examples of creation in the language documentation:



For this language we can find some examples of cookie creation in the following portal; Although it does not belong to the official documentation, we consider that they are quite valid for our development.


In the case of using Frameworks, they have their own documentation for the creation and administration of cookies; Some of the links with this information are:

Angular: https://docs.angularjs.org/api/ngCookies/service/$cookies
React, Vue.js, Node.js:
https://www.npmjs.com/ package/react-cookie


Adequate documentation is available for this language at:



The use of cookies can be a great ally to improve the user's browsing experience, as well as to acquire information that allows us to know the browsing preferences within our page and the interest in certain products or services of our portfolio. .

The recommendations are given by the IETF in its document 6265; Therefore, it is important to read it to learn about implementation, vulnerabilities, use cases, headers, among others, that allows us to implement a safe and efficient solution for users.

Whenever our site stores cookies on the user's machine, we must make it known that we are collecting information and the data processing policies.

did you find this article helpful?
Wink Hosting USA