Websites are always interested in knowing the web habits of their users. They want to know how often a particular user visits their site and which pages he traverses. The mechanism of cookies works as follows:
- When you type in the domain, you make a request upon the server that is hosting the site.
- The server then sends you the web page, which corresponds to the request made by you.
- The response contains a cookie, which stays on your hard drive.
- Most cookies generally contain parameters like name of the cookie, value of the cookie and its expiration date.
Types of Cookies
- Session cookies- They are temporary. They are removed when you close the browser. In your next visit to that site you will be treated as a new visitor. In case of a session cookie, there is nothing by way of which a browser can let know the website about your prior visits to it.
- Persistent cookies- They persist on your hard drive till you remove them or they expire.
- First Party cookies- When the website you are visiting, issues you a cookie, it is a first party cookie.
- Third Party cookies- Imagine that the website you visit is hosting some advertisements. The advertisement site may also issue a cookie to you. This cookie will be called a third party cookie.
Cookies are of use in Internet advertising. Advertisers can obtain information about the on-site behavior of visitors with the help of cookies. The personal information of the visitor is anonymous but his or her web surfing habits are recorded and can be tracked by way of cookies. A website can actually promote specific products to the visitors based on the information gathered from cookies, about advertisements they click on. Cookies help determine the host server, which banner advertisements you have seen. They can convey this information to their advertisers.
E-commerce sites implement the idea of shopping carts by utilizing the concept of cookies. The cookie contains an ID and enables the site to keep track of the things you add to your cart. When you add an item to your shopping cart, it is stored along with your ID in the database of the site. The site knows what’s in your cart, when you check out.
Cookies and Session Management
Working of the HTTP protocol is of a stateless nature, which means it is not possible for a HTTP web server to differentiate one user request from another. It becomes very important for a developer to achieve session management. Session ids associated with cookies play a vital role in uniquely identifying client requests. Session stores the information pertinent to a particular user for the duration of his visit.
Cookies help you get rid of repeatedly following certain procedures on the site, like form filling or signing in. Once you are a registered user, you may not have to perform the process of signing in each time you visit the site. Once you have filled forms, the information filled can be remembered by means of cookies. Shopping websites can base their purchase recommendations on the information supplied by you.
It is not really true that cookies compromise your security. But, yes, they affect your privacy. Cookies are not executable programs, which can harm your computer. They are literally plain text. Regrettably, there are some cookies storing personal information. A cookie can identify the computer and the software you are using. A dishonest site can make available, your information to outsiders. So, if you do not want to be monitored by websites, it is best to delete cookies on a regular basis.