: Advertising networks such as DoubleClick, Quantcast, Microsoft, Yahoo!, and many more others use a variety of techniques to know which sites you visit and which ads you respond to. They do so in order to specifically target the ads you see.
The most common way they do so is by setting a tracking cookie using a Web bug (a small image or piece of code that links back to the ad networks' servers and sets or reads a cookie). Each cookie has a unique code to identify your Web browser; when combined with site-specific information sent by the Web bug, it tells the ad network which sites and pages you visit. (Such cookies are distinct from those that Websites themselves set to track you locally or preserve preference settings).
Tracking cookies are just one technique ad networks use to track your activity. And those networks can track you only when you visit sites that participate in their programs. But because nearly every Website now shows ads and because some ad networks are so pervasive, they can track and record a significant chunk of your Internet usage.
In theory, ad network cookies are anonymous; they track your browser, not you personally. However, they can be correlated to your name using things like your IP address. Right now, that's more creepy than dangerous. But down the road, cookies could be tied to you more personally and used to customize things like the prices you see on products.