In many respects, Facebook (FB) - Get Reportand Alphabet/Google (GOOGL) - Get Report are forming an online ad duopoly that, if not exactly a friendly one, is at least one in which the companies can avoid being at each other's throats. A duopoly in which both companies can maintain the loyalty of top advertisers thanks to unique strengths--for Facebook, its ability to deliver well-targeted ads on its social platforms based on mountains of user data, and for Google, the still-unmatched ability of its search engine to deliver ads relevant to what someone is interested in at a particular moment.

Even in the video ad market, where Facebook and Google's YouTube are often going after the same ad budgets, one could argue that each company's biggest rival is really the massive TV advertising market. As a long as video ad dollars steadily shift from TV to digital channels amid a backdrop of cord-cutting and declining ratings, there will be plenty of room for both Facebook and YouTube to grow.

Where this semi-friendly state of affairs breaks down, however, is in the battle to run ads on the sites and apps of third-party publishers. In this established, slower-growing market, Facebook is intent on grabbing share from Google's DoubleClick unit, which has long been a top player, and for a few reasons is well-positioned to do so.

Jim Cramer and the AAP team hold positions in Facebook and Alphabet for their Action Alerts PLUS Charitable Trust Portfolio. Want to be alerted before Cramer buys or sells FB or GOOGL? Learn more now.

On Wednesday morning, Facebook announced that its Audience Network, which shows ads on third-party mobile sites and apps, will support an increasingly popular technology known as header bidding. Header bidding allows a publisher to simultaneously field real-time bids for ad inventory from multiple ad-buying platforms (including, now, Facebook's), which in turn are used by a variety of advertisers. The exchange providing the highest bid for an ad impression gets to show it.

Interestingly, Amazon.com (AMZN) - Get Report, which has a booming e-commerce ad business, is one of the six header-bidding technology providers that the Audience Network will support. Ad tech firm AppNexus, which has reportedly filed for an IPO set to occur in the second quarter, is another. Though focusing on mobile for now, Facebook says it's also testing the use of header bidding for PC video ads.

By providing a higher level of competition between exchanges, header bidding can boost ad prices relative to a traditional "waterfall" approach, in which ad inventory is first offered to a single exchange, and then potentially offered to other exchanges in sequence if the inventory fails to draw an adequate bid.

Facebook claims Audience Network clients that have tested header bidding--the list includes The Washington Post, The Daily Mail and Forbes--have seen 10% to 30% revenue increases. Last November, Verizon's (VZ) - Get ReportAOL unit said more than 100 publisher partners had adopted its header-bidding solution.

In addition to greater competition, better transparency is a big selling point for header bidding. Publishers immediately know what all exchanges have to offer, and there's little room for one of them to play arbitrage games or manipulate demand thanks to its place in the bidding process. And that includes DoubleClick.

Many online publishers use the DoubleClick for Publishers (DFP) ad server to sell their inventory. DFP lets Google see all of a publisher's inventory, and is integrated with a DoubleClick ad exchange that has the chance to make a final bid on inventory after a "winning" waterfall bid has been submitted, through a solution known as Dynamic Allocation. This gives DoubleClick's exchange a chance to cherry-pick the most lucrative inventory, which in turn gives ad-buyers a big incentive to use it.

TheStreet Recommends

While DoubleClick's exchange could in theory do the same following a header-bidding auction, a more competitive and transparent bidding process tends to make it less likely that DoubleClick will be able to provide a higher bid. Last spring, an ad exec speaking with trade site Ad Exchanger reported that some publishers that have added header bidding "see Google's share of revenue decline from 90% to just 40% to 50%."

About a year ago, Google announced an effort to combat header bidding by giving third-party ad exchanges access to Dynamic Allocation. However, the solution is still in testing, and many exchanges are reportedly wary of it due to concerns about transparency, DoubleClick's revenue cut and other issues.

As it is, Facebook has become a headache for Google's display ad operations. This has partly been due to the shift in display ad spending toward social feed ads, a space that Facebook dominates via its core news feed and Instagram. But the Audience Network has also played a role, thanks to its ability to let publishers show targeted mobile ads based on Facebook profile data.

Facebook's data not only allows for advanced targeting, but also allows for this targeting to happen across devices. Facebook can use data it has gleaned from a user's PC activity to send a relevant mobile ad. Amazon, for example, might be able to show e-commerce ads on apps using the Audience Network based on a Facebook user's Amazon desktop browsing activity. Such cross-device targeting is harder to pull off when relying on cookies, as rivals often do.

In addition, the Audience Network's support for native ads that look much like news feed ads makes it possible to run cross-platform campaigns. Facebook disclosed in late 2015 the Audience Network was on a $1 billion revenue run rate; the figure might be much higher today.

Research firm eMarketer recently forecast that Facebook's total U.S. display ad sales, including for social feed ads, would grow 32.1% this year to $16.3 billion. Google's U.S. display ad sales were forecast to grow a modest 7%, to $5.2 billion.

Google still has some meaningful strengths. Its AdMob mobile ad network, which also supports native ads, is still used by many top developers, especially on Android. And as third-party publishers embrace video ads in a big way, Google can give brands the ability to run campaigns across both publisher sites and YouTube. Also, though it's still early, the company has reported many publishers who are using Google's AMP platform--it allows mobile pages accessed via Google Search and News to load almost instantly--have begun using DoubleClick's ad exchange to monetize their content.

But right now, it feels as if the momentum in the display ad realm is squarely on Facebook's side, at least outside of video. Though by no means a winner-take-all game, Facebook's data, reach and pragmatic mindset should pay off very well.

Editors' pick: Originally published March 22.

Action Alerts PLUS, which Cramer manages as a charitable trust, is long GOOGL and FB.