They're monitoring your online activity, recording and tabulating everything you look at. No, it's not the Americans' National Security Agency, just another day on the web with sites tracking your browsing so they can sell you things.
Cookies - or magic cookies to use the full technical term (yes, really) - predate the web. In computing, something is magic if its meaning or purpose isn't obvious. For programmers, for example, a magic number is a bare number with no explanation. Presumably someone once knew why 113 had to go just there, but alas it is now reduced to an arcane incantation.
Magic numbers are best avoided but magic can be good, too. A magic cookie is a piece of data that a program hands out which has no use except to be fed back into the program later on. It means something to the program but not to outsiders. It's not clear why these are called cookies: potential origins run from Alice in Wonderland and text adventure games to Andy Williams, but there is no definite etymology. Magic cookies, it seems, are magic in more ways than one.
Cookies were originally added to the web to remedy a defect in the hypertext transfer protocol (HTTP), the set of rules defining how web browsers talk to web servers. In its original form HTTP allows a browser to request web pages from the server hosting a site, and this works well when pages aren't tailored to each user, as when looking up Wikipedia or checking the news.
Unfortunately, basic HTTP provides no way for the server to know that the person requesting page B now is the same person who requested page A five minutes ago. This is a problem for things like shopping sites that have to remember you, so they can show you what's in your basket or secure sites that have to remember you so they know you are logged in.
Enter HTTP cookies. When a browser requests a page from a server the server can send back an arbitrary block of data - the cookie - to the browser. On all subsequent requests the browser sends the cookie back to the server. Typically the cookie is a unique string of random characters that the server associates with your shopping basket, your account details, your preferences or whatever.
Alas cookies can be abused, too. They allow individual websites to track your every move within their own corner of the net. Even worse, advertisers which operate across many different sites can set a cookie each time you visit a page containing one of their ads and gradually build up a wide-ranging profile of pages you've visited. Cookies can be finely controlled with today's browsers but because they underpin so much of the web it's impractical to completely eliminate their misuse.
Whether digital or chocolate chip, cookies are wonderful things - you just have to remember you can have too much of a good thing.
- © Fairfax NZ News