Header Bidding

The Definitive Guide to Header Bidding

Sovrn Publisher Advocate // February 17, 2016

feet on stairs

Header bidding is revolutionizing the digital advertising world, and for good reason – it works. Not only does header bidding increase ad revenue significantly, it also requires less ongoing maintenance, facilitates more accurate reporting and results in fewer discrepancies.

Header bidding is unique because it allows publishers receive bids from every partner simultaneously so the impression is always awarded to the highest bidder. The result is a fairer auction for SSPs, and more money in the publisher’s pocket.

Another great aspect of header bidding? It’s low maintenance. While a traditional waterfall setup requires near-constant attention, header bidding allows for a “set it and forget it” approach. In most cases, publishers traffic their line items once and then simply monitor performance.

Limitations of Waterfall Optimization

Prioritization based on historical performance rather than real-time performance

With a traditional waterfall, ad partners are prioritized in the ad server by evaluating past performance performance benchmarks for CPM and fill rates. This is not only time consuming but also inefficient, as oftentimes the highest bid doesn’t come from the first partner in the stack. This is especially an issue for volatile accounts that may change in value day by day.

Compounding discrepancies

Waterfalls also suffer from the issue of compounding discrepancies. At each tier in the waterfall, discrepancies occur, generally between a rate of 10-15% at each tier. Because header bidding doesn’t rely on passbacks or tiers, discrepancies are significantly reduced.

Constant updates

In order to keep valuations current in a waterfall, ongoing optimization is required. For sites that don’t have a dedicated ad operations team, this is especially problematic.

Benefits Header Bidding

Real-time valuation of inventory

Header bidding provides a real-time valuation of inventory as ad partners are buying impressions at the highest rates they’re willing to pay.

“Set it and forget it”

With header bidding publishers can enjoy a “set it and forget it” approach by completely eliminating passbacks and ad stack management. Though there is a bit of an upfront implementation lift in order to get the onpage elements and ad server set up ready to go, after that it’s smooth sailing. Publishers can traffic their line items once and then simply monitor performance.

More revenue

Thanks to a major decrease in discrepancies, more accurate valuations of impressions and less on going maintenance, header bidding results in a significant revenue bump for publishers. Many Sovrn publishers have reported upwards of 30% increases in yeild. But generally speaking, publishers can expect a revenue increase of around 10-20%.

The Drawbacks of Header Bidding

Can be development heavy

Writing your own header bidding container to access your various demand partners is time consuming and requires a high level of effort from your own engineers or the expense of hiring a third party development partner. Some providers have a standard solution which they will then customize to individual publishers’ needs, albeit for a cost. Simpler, nearly “plug-and-play” solutions also exist but do require some engineering sophistication to troubleshoot the implementation, though providers often provide this service as well.


Because the header bidding code is installed directly in the site header, there’s a slim possibility it can cause site latency issues. One way to avoid this is by using asynchronous scripts in the head of the page, which is supported in HTML5 and by all modern browsers. Regardless of asynchronous mode, all browsers do limit the number of connections open to the same endpoint at the same time, so caution should be taken not to make too many requests.

“[Before implenting header bidding], we had previously attempted various optimizations such as segmenting our international inventory, playing with frequency caps, and resetting line item rates on a daily basis. All of which didn’t seem to make a great deal of sense when dealing with a multitude of partners and we were left with a sense that we were basically chasing our tails.” – Ahmed Karim, Ad Operations Lead at SpanishDict

Understanding the Tech

Header Bidding Elements, Simplified

Every header bidder has three essential components: the request, the container (or wrapper) and the displayed ad.

The ad request

The ad request calls your bidders and asks them to return an ad creative and an offer price.

The container

The container, also called the wrapper or the mediation layer, wraps or contains all of the bids that you send to your bidders. Within 500-1000 milliseconds, the container sorts these bids and selects the winner.

The ad creative

DFP or your chosen ad server returns ad “creative” to the page which extracts and displays the ad from the bids returned via the header code.

With these three main elements in place, here’s an overview of the header bidding workflow…

When a user visits the website, the header script “sees” this user and sends a request to all of the integrated partners (SSPs and exchanges) simultaneously and each partner initiates an auction with their DSPs. The DSPs then return their bids and the winning bid is returned to the ad server so the ad server can determine the final line item to serve. The marketer’s ad server is called with the final line item and the ad creative is returned via CDN and loaded on the page. Notice that the workflow of this process is very similar to that of a waterfall except all of the partners are called simultaneously instead of routing the call through a number of passbacks. 5

A Deeper Look at the Header Bidding Workflow

Requesting the ad

First, you will get tags or ad units from your ad partners as usual, or you can use prexisting tags or ad units. Each partner has a different set of required parameters in order to ask for an ad from the header, so make sure to understand each of your partners’ unique requirements. Some common requirements for the ad request include:

  • Request endpoint URL
  • Impression ID
  • Ad size or array of sizes
  • Floor price
  • Ad Unit ID
  • Publisher ID

The callback function

The callback function is a response inside of the container. A callback function is basically one function that is used to trigger another separate function. Confusing, right? Put another way:

Say we have a machine, and on the machine there is a red button and a green button. When the red button is pushed, a red light is turned on. We will call that Function 1. But when the green button is pushed, Function 1 is triggered. The outcome is that pushing the green button also turns on the red light.

This is essentially what we’re doing with callback functions. The data that is returned from the bidders is saved in Function 1, and when we need the information in Function 1 we create a second function, the callback. We create a separate function that runs the callback function. That would be Function 2.

So to return to our example, you push the green button and the red light turns on, or you run the bid extraction function and the callback function runs, making the data itself accessible to the page. If you want to learn more about callback functions, our friends over at Stack Overflow have a much longer explanation of this technology.

The response usually contains:

  • Impression ID – to match request
  • Bid price in CPM – may be exact or estimated
  • Ad creative
  • Ad Sizes

Handling Response – The Container

Remember the JavaScript code in the head of the page? This code defines our container function and handles the bid responses. The JavaScript’s mission in life is to get the bid prices from the multiple bidders, sort the bids by price, and extract the ad creative code, possibly storing that in another callback function.

Once all the bids are returned and the container is timed out (typically 500 to 1,000 milliseconds), the DFP line item is targeted at the winning price. If we had five header bidding partners, five bids would be returned in the response. If the highest bid was $4.75, DFP’s set targeting function would target the $4.75 line item (or the closest line item) that was created during header bidding setup in DFP.

Displaying the ad

Now that the winning line item has been targeted, creative code is written to the <div> by DFP in a <script> tag.  The ad creative associated with the winning bid for the Div ID is matched. The matched creative is written into a containing iframe matching the requested ad size, an impression pixel for the ad is fired, an impression is logged and the publisher’s account is credited.

Setting Up DFP

Before you start header bidding you’re going to want to consider these three important items.

Ad units & creatives

Which ad units are eligible for header bidding competition? What size creatives do you want, and how many? You’ll most likely want to set up your line items to be flexible enough to serve multiple ad units and sizes on the page.

Price increments

What size price increments should you choose? Large intervals are quick to set up, but often under-value the impression. On the other hand, small intervals take longer to set up but result in more revenue and more detailed performance reporting. We recommend using $0.01, $0.05, or $.10 increments to start.

PRO TIP: If you’re using DFP, there’s an imposed limit of 450 line items per order, and a maximum of 61,000 active line items. So if you’re setting up multiple header bidders with very small increments such as $0.01 you could run into a limit restriction. Luckily, upping the restriction is as easy as reaching out to a DFP consultant and asking for an increase.

Key value creation

After you specify price increments, set up your key values. In the case of Sovrn, our key value is hb_pb. Your values start at $0.00, and go as high as you’d like. Key values generally go as follows: 0.00, 0.10, 0.20, 0.30, etc. Note that your key value must fit this format, and must start at $0.00.

Order and Primary Line Creation

When you’re setting up your line items, you should set up the first line item from start to finish and then make copies of this original line item. It’s important to make sure the first line item is 100% correct, or you will have lots of extra work later on.

Next, create a placement. Group your ad units together in the placement, and when you’re setting up the line item target the placement and any sizes you might want to add in the future along with your current sizes.

Order and Line Item Creation

header bidding guide


1. Create one line item. Naming convention generally include the price band, i.e. sovrn_ HB_0.00

2. Include all inventory sizes for your ad units

3. Allow same advertiser exception unchecked

4. Check unlimited end date

5. Check price priority, no limits on impressions

6. For display creatives, select one or more.

7. The CPM for the line item should match your desired price band. For example, if you’re starting at 0.00, this first line item will be zero

8. Save your line item and select “creatives in the left side menu.

Review of Creative Settings

1. Select the same advertiser as on the order

2. Name it clearly

3. Use the same snippet for all creatives – you only have to create this once

4. Target ad unit sizes one by one. The reason for this is when you add it to the line item you want to do a size override to allow it to serve to any of those sizes on the page. This tag isn’t where the creative is coming from, it’s a method through which the returned creative can be filtered through DFP.

header bidding guide 2


Creating Remaining Line Items

1. Return to your line item. Select “Use existing creative” for any size, then select “show all” to remove creative size filtering

2. Find and add the creative

3. Use size override, add all sizes you want to use

4. Duplicate for as many creative as needed

5. Make sure to check all your work: review line items, price band CPMs and key-values.

Header Bidding Best Practices

Limit your number of partners to what is manageable

There are two reasons to limit the amount of header bidding partners you have. First, the more partners competing in your header auction, the longer it will take to set up. Second, an excessive amount of header bidders can contribute to page latency issues. Our Product Team recommends using eight or fewer header bidding partners in order to avoid these setbacks.

Set all partners to Price Priority in DFP

Setting all partners to price priority in Google’s DoubleClick for Publishers (DFP) helps ensure that no artificially high priorities or impressionables are interfering with the ad server’s ability to serve the most valuable creative to the page at any given time.

Use the smallest price increments possible

Smaller price increments drive up revenue by improving precision in the auction. For example, if your price increments are set at $1.00, the winning bid will essentially be rounded down to the nearest dollar. Conversely, with $0.01 increments, the winning bid will be matched exactly every time, making sure you are awarded the highest CPM for your inventory every time. Another benefit of small price increments is improved accuracy and detail in reporting.

Use USD in your ad server (if possible)

Most header bidders operate in USD, so the price increments you’re setting up in DFP will have to be exchanged from USD to the currency you’re using. This means publishers with DFP account settings in currency other than USD have more maintenance to do.

Set price floors at 80% of your target CPM

A good rule of thumb is to initially set your price floors at 80% of your target CPM. Then you can adjust floors as needed to meet yield targets based on the actual yields you see from the header auctions on your site.

Frequently Asked Questions

What wrapper would you suggest?

Sovrn chose Prebid.js as the foundation for our own wrapper because of its adapter support, ease of implementation and performance. Index Exchange’s Headertag product has good reviews from publishers but has a longer implementation ramp and is not a selfserve model currently. You will need someone to set it up and customize for you; both Sovrn and Index Exchange offer this service. What wrapper would you suggest? How effective is header bidding for mobile? Especially considering the recent Google AMP launch and increased emphasis on loading speed for SEO? Instead of doing the auction in the header, is there a server side solution which does not put the load on the client?

If I just started my website, is now a good time to jump into header bidding as I am still building my audience?

If AdSense is your only monetization partner right now, then you should wait to jump into header bidding. Once you add another partner or a few partners, you will see increased revenue from header bidding as opposed to traditional waterfalling. Sovrn offers both Header Code and Header Complete, which make getting live with header bidding a breeze. Email headersuite@sovrn.com for more information.

Instead of doing the auction in the header, is there a server side solution which does not put the load on the client?

Yes and no. Both Sovrn and other exchanges and SSPs have direct server-to-server relationships with header bidding partners through both RTB and direct requests. Most exchanges require user cookie data either directly from the page or from a “cookie mapping” setup so server-to-server doesn’t work when user cookies aren’t available. Sovrn is working on a publisher level cookie map and would be happy to discuss with you in more detail; email headersuite@sovrn.com for details.

How effective is header bidding for mobile? Especially considering the recent Google AMP launch and increased emphasis on loading speed for SEO?

Header bidding is effective for mobile albeit with lower fill rates due to both a lack of cookied readers and bidder timeouts from greater network latency.

What if I don’t have in-house technical resources to get started?

Sovrn offers a self-serve, easy to implement header bidding solution called Header Code. We also provide free consultations and installation through our header bidding team. Email headersuite@sovrn.com to schedule a consultation.

Can header bidding cause any problems with geotargeting?

The short answer is no. If you’re geotargeting inside DFP, DFP’s still going to follow whatever geotargeting or geofencing rules you already have in place.

On the flip side of that, when we Sovrn sees an ad request come through the header auction we are still getting any geographic data that is available to us and we can act on any targeting rules that have been implemented on the server side.

Other than DFP, what ad server do you recommend for a small to mid size publisher that is just starting to implement the header bidding process?

We have found that DFP was in heavy use on the header bidding integrations we have worked on to date. To be clear, if you’re a publisher and you’re not using DFP today and you’re using a different ad server, there are ways to get header bidding to work using the PreBid.js framework using other competitive frameworks. Technically, you don’t need an ad server ad all. You can get ads back to the head of the page, you can sort the bids, and then you can have some creative code on the page itself that gets the highest bid all without using DFP or any other ad server. This all requires a technical resource though, so we still recommend DFP, especially if you are just starting out.

 Assuming unlimited resources or bandwidth, how many partners would you recommend at maximum?

Once you start getting into advanced configurations of header bidding and if you have a really well optimized header code, we have seen as many as eight header bidding partners work successfully. Any more than that and you start to see a point of diminishing return. You’ll want at least two or three to have some unique demand behind them.

Want to learn more?

Share this article