Say you're browsing the virtual shelves of an online clothing store. You move a blue shirt into your shopping cart. Then you decide against it and click over to a news story. You've left the store, yet the blue shirt is trailing you. There it is, on an ad from your local news site. Days later, you open Facebook, and there it is again. The same blue shirt. How did Facebook know?

The phenomenon is called "behavioral retargeting." It's been used by advertisers for at least seven years, and it's now growing increasingly popular, as tracking technologies improve and companies spend more money advertising online.

More on Technology

For advertisers, it's a home run. Turn-of-the-century businessman John Wanamaker famously said, "Half the money I spend on advertising is wasted; the trouble is I don't know which half." Retargeting eliminates that waste, or at least tries to, by advertising only to people who they know are interested in their products.

Once a store knows you like the blue shirt, why not offer a gentle reminder of it? On average, you see 1,700 banner ads a month. You probably ignore them all, but you might notice that shirt again. The question is, how did anyone know you liked that shirt, and are you OK with them knowing that?

Here's how retargeting works: Each time you visit a site, it drops something called a "cookie" on to your Web browser. That cookie, which can stay for up to a month, is anonymous. The site doesn't know who you are, or anything about you, but it knows you looked at that shirt. Then the site can purchase ads through a number of retargeting companies acting as middlemen, selling the ads aimed at you, the anonymous shopper, on behalf of news sites, blogs and even Facebook.

The practice has become increasingly widespread because it works. In a survey of 400 clients by San Francisco-based retargeting company Adroll, 74 percent said their retargeting ads performed better than regular banner ads. For that reason, retargeted ads can cost as much as three times more. At least a dozen companies offer the service, including startups you've never heard of, such as Adroll (which is on track to do $100 million in annual revenue, according to the company), Criteo and Fetchback, as well as large companies such as Google. Facebook and Twitter have recently started selling retargeted ads, so that ads inside their social networks can target you based on your activity across the Web.