Facebook is testing and will soon launch Facebook Exchange, a real-time bidding ad system where visitors to third-party websites are marked with a cookie, and can then be shown real-time bid ads related to their web browsing when they return to Facebook. This retargeting option could be a huge money maker for Facebook as it will allow for more relevant direct advertising.

For example a travel site could serve ads about a flight to Hawaii to someone who almost bought a flight on their site. Advertisers might pay big premiums for highly-accurate targeting. Users will be able to opt out of Facebook Exchange via third-party demand-side platforms, but they can’t opt out of the program completely from within the social network.

Facebook just notified TechCrunch that Exchange is currently in testing with eight advertising demand-side platforms, and it will become more widely available in the next few weeks for traditional Facebook sidebar ads charged at cost-per-thousand-impressions, but not Sponsored Stories or mobile.

The demand-side platforms currently testing Facebook Exchange, or FBX as some Facebook employees are calling it internally, are: TellApart, Triggit, Turn, DataXu, MediaMath, AppNexus, TheTradeDesk, and AdRoll.

Here’s how Facebook Exchange works:

A user visits a travel site that’s hired a DSP rigged up with Facebook Exchange A cookie is dropped on that user’s computer, typically when they’ve shown purchase intent If the user fails to make a purchase, or the advertiser wants to market to them more, the DSP contacts Facebook and gives them the user they wish to target’s anonymous User ID The advertiser pre-loads creative for ads that would target that user When the user visits Facebook it recognizes the cookie dropped by the DSP The DSP is notified and allowed to make a real-time bid to show the user ads The DSPs with the highest bids get their highly-targeted ads shown to the user If the user disapproves of being shown the ad and ‘X’s it out, they’re shown a link to the DSP where they can opt out of future Facebook Exchange ads

Facebook’s Annie Ta tells me the idea behind Exchange is to let advertisers show users more relevant ads. To date, Facebook has been generally viewed as a home for institutional or brand advertising. However, it’s seen as much less useful to direct marketers than search ads because users on Facebook haven’t shown purchase intent as when they search for a related keyword on engines like Google.

Facebook Exchange could change all that.

For example, Ford could drop a cookie on a user who looks at the new Escape SUV on its website, but doesn’t request a local quote. Then Ford could bid to show that user ads stating “Ford Escape: Just $21,000”. These would be much more relevant than generic Ford ads showing sedans or trucks that the user might not be interested in. And Ford would likely be willing to pay a high price to reach that qualified lead.

[Update: As Bloomberg’s Douglas MacMillan notes, FBX could also power time-sensitive advertising because ads are bid on and delivered to users in real-time as the browse the site. That permits urgent advertising, such as ads directing users to a turn on currently airing TV show or sporting event.]

Facebook may make some users uneasy in order to cash in on this new revenue stream, though. Cookie-based ad retargeting is common across the web, and Facebook is going the protecting privacy by not allowing advertisers to combine cookie retargeting with the with the extensive biographical, social, and behavioral data Facebook has on its users. Still, some people just dislike being targeted. Those people will be able to use a third-party opt-out on the sites of demand-side platforms to stop receiving the cookies.

However, I asked if Facebook would offer users an easy, one-click way to deny the social network the ability to target them based on cookies from all DSPs, and it said that won’t be offered for now. That’s in part because it can’t control whether DSPs drop cookies or not, though it can make the call of whether to use them. Not allowing retargeting to be combined with Facebook’s own ad targeting data is a pretty strong privacy protection, and makes Facebook Exchange ads the same as any other retargeted ads around the web.

If investors were looking for clues as to how Facebook could ever get to the $104 billion valuation it IPO’d at, Facebook Exchange should excite them. It shows Facebook is willing to shift towards slightly more aggressive advertising mechanisms.

While just a year ago Facebook ad targeting was only based on user-entered personal information and interests, now both browsing behavior and activity within apps, for example listening to a specific artist on Spotify. Facebook already leads the overall US display advertising market which totaled $12.4 billion in 2011, with the social network’s share of market revenue growing to 14% in 2011 from 11.5% in 2010. If Facebook Exchange gains traction, Facebook could beat eMarketer’s estimate that Facebook’s share will grow to 16.8% of the predicted $15.39 billion market in 2012.

But most importantly for the long-term health of Facebook, FBX means that users could see more ads for things they actually want to buy, rather than viewing the ads as annoying distractions.

[Image Credit: Andrew Magill, Acquisio]