Using cookies could be the simplest and fastest way of storing site preferences and other data that has to be sent back to the server for data analysis. If there is one single factor that has determined the humongous expansion of many websites, it is because of the cookies they use.
Cookies are incredibly small items of code that collect data from a browser and stores it for future use or sends the data back towards the server. You might have noticed that when you enter the first letter or perhaps your user name to sign in to Facebook or Gmail, it provides you an option that could be the ID that you would have used in the past. This is achieved by using a cookie that stores data on your own local machine. Thus you won't need to take the trouble of entering your user name again.
Cookies can be used for one main purpose - collect and store data.
Tracking a person's activity and saving a person's preferences is just an implementation of employing the cookies that have stored data. Although cookies breach privacy, they make your life easier by causing the web more customized.
Cookies are implemented on-line by using scripting languages like JavaScript or through the use of server side languages like PHP, ASP.NET, ColdFusion, etc.
The future of cookie could be the super cookie that stores data forever, unlike the cookies which might be used currently that expire after a time period.
Image Credit: Mindmatrix - Wikipedia
Cookies are widely-used to store data and based on a certain logic or each time a condition is met. The data saved in the cookie is utilized either by the browser or it is sent to the server of the website that you visited. A ultimate example to understand this functionality in the cookie is shopping carts.
When you visit an internet store, you have a shopping cart solution that will list the items that you just bought. If your browser crashes, without cookies, you will have to go through the entire means of adding circumstances to your cart. Worse enough, you might not remember everything that you bought. Cookies solve this scenario by storing data of all of the items that you just bought so that it's not necessary to worry about losing your data.
In fact, the 1st time ever a cookie was utilized, it was adopted as a solution for any problem encountered while developing a web-based E-Commerce website. The invention of the computer cookie is credited to Lon Montulli when he was employed by Netscape Communications.
Now that you simply have very good understanding of how cookies work, let's move to the next functionality of cookies - saving user preferences.
I will illustrate this feature using a good example. Even if you are a brand new to using internet, you'll have heard regarding the website called YouTube.com. The first time you visit YouTube.com you will see the thumbnails to get a few videos. After you watch several videos and again visit type in the URL as YouTube.com, you will recognize that there will be a few links on the videos that has to be of your taste.
What YouTube does is, it keeps track in the videos which you watch. This details in the videos which you watch is sent for the server through the cookies stored in your computer. When you visit YouTube's webpage, YouTube performs an analysis in the cookies and displays you links on the videos that you just might have an interest to watch.
You can try something similar on google.com, bing.com, etc by changing the default language. When you visit those websites again, you will see that the pages are displayed within the language which you selected to get your default choice.
Another great example iGoogle. It is probably the example that you just can find online. Play with them and you will understand how cookies work. Apart from saving data, customization could be the next great functionality which is why the cookies are utilized.
Image Credit: Mindmatrix - Wikipedia
Since cookies can very easily collect data relating to activities as well as other required data, they have been adopted by nearly all website to study anyone's activities and use it to their advantage. Websites like Google, collect this list of words which you search for and display advertisements in accordance with your searches by analyzing your pursuit activity. This is made possible by cookies that have stored your searches.