How to reduce cookies size and why is important?All
What is a cookie?
A cookie, known as an HTTP cookie, web cookie, or browser cookie, is data sent from a website and stored in a user’s web browser. It is a simple computer file made of text and the information stored in it can be used to personalise the experience when using a website. HTTP cookies are used for many reasons such as authentication and personalization.
Information on cookies are exchanged in the HTTP headers between web servers and browsers and for that particular reason it’s important to keep the size of cookies as low as possible to minimize the impact on the user’s response time. Cookies can also store passwords and information a user has previously entered, such as credit card number or address. (not recommended!).
Here you can see few ideas about how to decrease the number of cookies your website is using:
- Save on cookies only the necessary information
- Don’t create cookies for everything!
- Use a session to store information
- Put a short expiration time
- Limit the cookie by domain name and protocol
- Don’t save text on it. Try to use boolean variables or numbers
Why is important to reduce the number of cookies?
When a user accesses a website that has a cookie function for the first time, a cookie is sent from the server to the browser and stored by the browser on the local computer. When that user comes back to the same website, he will be recognized because of the stored information in the cookie.
Cookies are a big problem for Internet privacy because they can be used to track browsing behavior and for this reason, many countries have made laws to protect people’s privacy. Improperly managing cookies can lead to all kinds of problem, from poor user experience to security holes.