Facebook has filed a fascinating patent that suggests it has considered building a mega ad exchange that harnesses its social data to serve ads and, interestingly, content (like paid-for news articles or videos from brands, otherwise known as native advertising) on sites beyond the social network’s own platform.

The patent application, published Thursday, details an ad exchange that combines an advertiser’s data with Facebook’s own social graph to find users that match a given profile — say, a woman in her 30s, who has recently bought a pair of sneakers, and who reads articles about running.

The exchange would then allow the advertiser or content maker to place their content within the exchange. That content could be a normal ad or — the interesting bit — a video, a Facebook wall post, news article, photo, gaming apps, and so on. (The latter types are lucrative, as people are more likely to engage with native ads than overt banners). So buyers trying to serve regular ads might find themselves bidding against a company trying to serve a video and a company trying to offer an app download.

Facebook’s exchange would then go on to serve that content to users who match the profile when they visit a participating publisher’s website (“publishers” meaning anything from newspaper sites, video sites, retailers, email service providers, or other social networks). If one or more advertiser wants to target the same type of user, the patent says they would enter a real-time bidding war, with the highest bidder eventually getting their content served to their desired audience.

It’s worth pointing out that Facebook files patents all the time, many of which never come to fruition. This latest patent application is a continuation of an application filed in July 2014, and that itself was a continuation of a patent filed in June 2011. Four years is a long time at a company like Facebook, and some of the data matching and targeting technologies the patent details sounds a lot like the Custom Audiences product it already offers.

Facebook declined to comment when contacted by Business Insider.

This could be huge

If this exchange comes to fruition that could be massive for the ad-tech industry, and the wider digital publishing landscape: Facebook’s data is essentially second-to-none. It knows who you are, where you’ve been, and what you like because you’ve told it yourself — it’s not guessing who you are based on your browsing behavior. The patent suggests this kind of targeting could easily work across both desktop and mobile. And, by serving both ads and content, it has the power to run as a hybrid advertising/native advertising exchange to service many needs for both the advertisers buying the ads and content, and for publishers looking to monetize their sites and apps.

It could also prove to be a huge chunk of bad news for Google, as it has the potential to draw publishers away from its AdSense and DoubleClick products.

It even has the potential to damage an entire industry: Content recommendation platforms like Outbrain, Taboola, ContentClick, and nRelate, which place paid-for content recommendations from publishers and brands on sites across the web. Those are huge businesses (Taboola is valued just under $1 billion), but none have the kind of verified data Facebook has in its war chest. They have some, but the majority of their targeting is based on inferences that you are indeed a 30-year-old female who likes running because of your past browsing behavior.

Here’s a diagram from the patent application that shows how the process would work.

facebook diagram

Facebook does already have two ad exchanges, FBX and its LiveRail platform. But FBX only allows advertisers to buy ads that appear on Facebook. And while LiveRail goes off-Facebook platform, it is currently limited to placing ads on videos and within mobile apps.

It is not clear whether the potential new ad exchange would be an extension of LiveRail (one would assume so, but the “LiveRail” brand is not mentioned — but again, this patent was originally filed years ago) or a different product altogether. Whatever way, the patent describes a social-driven ad exchange that could operate across any platform or format, serving both ads and content, and that’s powerful indeed.

It “makes sense” and it’s “exciting”

Eric Franchi, cofounder and chief evangelist at ad-tech company Undertone, told Business Insider the move makes sense. “It’s mobile friendly; it would give Facebook something new to offer publishers, who they have been courting more lately — perhaps higher CPMs [cost-per-thousand impressions] than other companies or an audience development product; because of their data, one can assume that they could provide more relevant ads than the current companies in the space — sometimes the content recommendations you see are pretty poor quality or not relevant.”

On the content-serving side, Sharethrough, a potential new rival, believes it is “exciting” Facebook is entering the market. Sharethrough, is an ad-tech company that allows publishers to sell “native” advertising that appears in the stream or feed of their content — it also has its own exchange that would be a direct competitor to the one described in Facebook’s patent.

Dan Greenberg, Sharethrough cofounder and CEO, told Business Insider: “Facebook has realized there’s an opportunity to sprint ahead of Google in the new battle for native ads on the open web, and they’re launching their own version of the Sharethrough Exchange, adding Facebook user data to the mix. I imagine Google won’t be that far behind in announcing new versions of DFP (DoubleClick for Publishers) and DBM (DoubleClick Bid Manager) that will support native ads, too.”

Facebook has been steadily building up its ad-tech arsenal of late: Expanding the LiveRail supply-side platform (SSP), relaunching the Atlas measurement platform and ad serveropening up the Facebook Audience Network (which allows advertisers to extend their Facebook ad campaigns to other apps using its targeting data) to all businesses, and it is rumored to be working on a DSP (demand-side platform) to let advertisers bid on highly targeted advertising inventory.

The idea is to build up a walled garden, just as Google has done, to cover every part of the advertising ecosystem, from supply side to sell side, measurement to targeting, and so on. By providing scale, and every mechanism required of the ad-tech stack, they are both trying to create a one-stop shop for marketers’ advertising needs. Those marketers might dip into other providers every now and then for specific requirements, but Facebook and Google are trying to ensure the majority of the digital ad buys across the web go through their respective systems.

Where Facebook has a clear advantage over Google is its data. The patent says the type of data that could be fed into the exchange (which would be a mix of its own and data from advertisers or third-party data providers) includes profile information, browsing history, purchase history, content item viewing history, and — crucially — data from its social graph (that’s the bit Google doesn’t have.) Personally identifiable data, such as email addresses, would be encrypted, the patent says.

It’s also that social networking ID that will help Facebook target and track users across devices — in this case it appears to be by firing tracking pixels when a user accesses a content item, which includes an encrypted Facebook ID. The patent explains how the cross-device identification system will work:

An online publisher provides content items such as advertisements to users. To enable publishers to provide content items to users who meet targeting criteria of the content items, an exchange server aggregates data about the users. The exchange server receives user data from two or more sources, including a social networking system and one or more other service providers. To protect the user’s privacy, the social networking system and the service providers may provide the user data to the exchange server without identifying the user. The exchange server tracks each unique user of the social networking system and the service providers using a common identifier, enabling the exchange server to aggregate the users’ data. The exchange server then applies the aggregated user data to select content items for the users, either directly or via a publisher.

facebook diagram 2

You can find the full patent application here.

This article was written by Lara O’Reilly (loreilly@businessinsider.com) from Business Insider and was legally licensed through the NewsCred publisher network.