Guide 04 · Header bidding
Header bidding collects bids while the page loads, then hands the results to the ad server with the ad request. This guide walks the auction as Prebid 11 runs it: the request, the settings that shape it, the key-values the ad server receives, and the line items those values need.
In short
- Current major
- Prebid.js 11; release 11.53.0, 20 November 2026
- Default granularity
- medium: 0.10 steps to a 20.00 cap
- Default timeout
- 3000 ms, set with bidderTimeout
Prebid is free, open-source software that runs a header auction: every demand partner is called at once while the page loads, and the results travel to the ad server as key-values. The ad server makes the final decision. What the publisher builds is a configuration: ad units, bidder entries, and line items that match the price buckets exactly.
What header bidding is
Without header bidding, a page called one ad server and that ad server decided which demand could serve, working through partners in an order set by their rates. Header bidding asks the partners to bid on the impression at the same time, before the ad server call, so each partner sees the same opportunity. The ad server then compares the header bids with its own demand and serves the highest rate.
Prebid is the open-source project that does this, launched in 2015 and maintained by Prebid.org. Its core product is Prebid.js, a JavaScript library that runs in the browser, supports display, video and native formats, and calls every bidder at once inside a timeout. A bidder that does not answer in time is left out of that auction. The ecosystem around it covers more than 300 demand partners through adapters and about 50 analytics providers, on the figures Prebid.org publishes.
How the auction runs
The page queues its calls on pbjs.que, an array that holds functions until the library has loaded. The Google Ad Manager tag is told not to make its first call on its own, so the auction has time to finish first. Then requestBids opens the auction: every adapter is called at once and a timer runs. When the bids have returned or the timer fires, a callback runs once, guarded by a flag so it cannot run twice. In the basic example that callback is named initAdserver: it writes the auction results into the ad server request with setTargetingForGPTAsync and then refreshes the slots.
What the ad server receives is targeting, not markup. Header bidding is a first-price auction, as the Prebid documentation states: each bidder sends its clearing price. On the ad server, line items priced to match those bids compete with the rest of demand, and the highest rate wins. Where no line item matches, the next demand in line serves instead. The exchange has to fit inside the page's budget, so the timeout is a real setting.
Ad units and the request
An ad unit describes one placement: the code of the element on the page, the media types and sizes it accepts, and one entry per demand partner, each with its own parameters. A page-wide setConfig call, made before the request, sets behaviour for the whole wrapper: bidderTimeout, priceGranularity, enableSendAllBids, and the OpenRTB fields of first-party data.
pbjs.que.push(function () {
pbjs.addAdUnits([{
code: 'div-banner-1', // the id of the slot on the page
mediaTypes: { banner: { sizes: [[300, 250]] } },
bids: [{
bidder: 'bidderA', // one entry per demand partner
params: { placementId: '12345' }
}]
}]);
pbjs.requestBids({
bidsBackHandler: initAdserver, // runs when bids return or the timer fires
timeout: 3000 // the default; set bidderTimeout to change it
});
});When initAdserver runs, Prebid writes the winning bid into key-values on the ad server request. Those key-values are what the line items target.
Price granularity and the timeout
Bids travel to the ad server as buckets, not as raw prices. The key hb_pb carries the bucket a bid lands in, and bids round down: a bid of 2.95 lands in the 2.50 bucket at medium granularity. The rounding changes only which line item competes, not the price paid; the winning bid still pays what the buyer offered.
| Granularity | Increment | Cap | Line items per bidder |
|---|---|---|---|
| low | 0.50 | 5.00 | 11 |
| medium, the default | 0.10 | 20.00 | 201 |
| high | 0.01 | 20.00 | 2,001 |
A sliding option called dense starts at 0.01 to 3.00, then 0.05 to 8.00, then 0.50 to 20.00, which works out at 425 line items. Prebid's built-in granularities were designed around typical bid prices in 2016 for USD and similar-value currencies, and Prebid recommends custom buckets for media that trades above the cap, video in particular. Custom buckets are set with priceGranularity in setConfig, and the line items must be rebuilt to match.
The timeout defaults to 3000 ms and is set with bidderTimeout. Every millisecond the auction stays open is a millisecond the ad server call waits, so the value is a trade: long enough for the slower bidders to answer, short enough that the page does not stall.
Key-values and the ad server
setTargetingForGPTAsync writes the results as key-values on the Google Ad Manager request. All of them carry the hb_ prefix.
| Key | What it carries |
|---|---|
hb_pb | The bid price in its bucket. The key the price line items target. |
hb_bidder | The code of the bidder behind the top bid, for reporting. |
hb_adid | The bid's id, passed to the rendering code by the ad server creative. |
hb_size | The size of the winning creative, used to size the frame it renders in. |
hb_format | The media type, banner or video, when line items are split per type. |
hb_deal | The deal id of a private marketplace bid. |
hb_uuid | The cache id a video creative fetches its VAST document from. |
hb_source | Whether the bid came from the client or the server, used to compare the two paths. |
hb_adomain | The advertiser domain, for review and for floors set on chosen buyers. |
The unsuffixed keys carry the top bid. Sending every bid is the default (enableSendAllBids is true), and each bidder then also gets a suffixed set: hb_pb_bidderA, hb_bidder_bidderA, and so on.
On the ad server, each bucket gets a line item. Prebid's Google Ad Manager guidance is to use the Price Priority type, to write every value with exactly two decimal places so the targeting matches, and to build two sets of line items to start with: one for instream video and one for everything else, with more sets where media types are split. Priority sits below directly sold campaigns and above house ads. Line items start immediately, carry no end date and no impression goal. An order in Google Ad Manager holds 450 line items, so a full setup splits across orders.
Prebid Server
Prebid.js runs the auction in the browser; Prebid Server runs the same auction on infrastructure. It is the route for environments without a page header to run JavaScript in: mobile apps through the SDKs, and server-side ad insertion for long-form video such as CTV, along with digital out of home and audio. It also serves plain web pages that prefer to keep bidder calls off the device.
The page keeps its ad units and adds an s2sConfig: the account id at the host, the auction endpoint, and the list of bidders to move server-side. Prebid Server holds more than 230 server-side adapters and calls them all inside its own timeout, which should sit about 200 to 300 ms under the client timeout; unset, it defaults to 75 percent of bidderTimeout or 750 ms, whichever is less. Prebid.js keeps the orchestration, the targeting and the rendering in the browser, and a bidder moved server-side no longer needs its client adapter in the build. Moving five bidders to the server turns five browser calls into one.
Consent, identity, data
The consent module reads the TCF consent string from a consent management platform and carries it to every bidder with the request. It is configured under consentManagement.gdpr, with the IAB interface as the default cmpApi and a wait of up to 10,000 ms for the platform to answer. Where consent data is missing at the end of that wait, the auction either stops or continues without it, and consent-gated demand, analytics and id systems are left out. Since version 11.14 a failed platform lookup also holds the user id module back. The TCF disclosure explains the string itself.
The user id module keeps a pseudonymous id in first-party storage and shares it with the bidders the publisher chooses. SharedID is the open one maintained by Prebid.org, stored in a cookie or local storage, and ids travel in the OpenRTB user.ext.eids field. Ids run only when the user has consented to the storage purpose.
First-party data travels on the same request. An ortb2 object in setConfig carries site and user data in OpenRTB structure to every bidder, and setBidderConfig scopes data to chosen bidders. Prebid also ships modules that validate and enrich that data before it leaves the page.
Version 11 and the majors
Prebid.js ships a minor release most weeks; 11.53.0, released on 20 November 2026, is the current one. Major versions are where breaking changes land, and Prebid.org advises upgrading at least every six months. The last three majors:
| Major | What changed |
|---|---|
| 11 | Ad pod and PAAPI modules removed; undisclosed browser storage fails by default; a bid whose media type does not match its request is rejected; viewability reporting rebuilt around a bidViewable event. |
| 10 | Legacy native targeting keys and the pbadslot field removed; the Prebid Server adapter requires an explicit endpoint; ids read from user.ext.eids; the supply chain object supplied through ortb2. |
| 9 | GDPR consent modules renamed to TCF; FLEDGE renamed to PAAPI; site, app and device configuration moved into ortb2. |
The direction is consistent: legacy fields removed in favour of the OpenRTB structure, and defaults tightened so a misconfigured page fails loudly instead of quietly.
Adapters and ads.txt
Each demand partner ships its own adapter, written and submitted by that partner and reviewed and tested by Prebid before release. A production build should include only the adapters the page uses; the full build that carries every adapter is published for evaluation and is not recommended for production. The adapters in the build are the list of demand partners the inventory is offered to, which is what ads.txt describes to buyers: the file at the root of the web domain lists the accounts authorized to sell that inventory, and buyers read it before they bid. The guide to ads.txt and sellers.json covers the format.
The usual mistakes
Most header bidding faults are configuration faults.
Line items that do not match the granularity, or that miss the two decimal places, match no bids at all, and the auction falls through to whatever demand is left. A change of granularity without new line items breaks the match in the other direction: the buckets on the bids no longer exist on the ad server. An ad server call that is not held back fires before the header bids exist, and the key-values never reach the line items. A timeout set longer than the page can afford trades the reader's patience for late bids. A build that carries every adapter loads code the page never calls.
What it means here
Vall Media's web integration runs Prebid header bidding with Google Ad Manager and Google AdX behind it, with direct and PMP deals layered on the same ad server setup. The header bidding page describes the wrapper as we run it, the Prebid integration page covers the adapter setup, and the Google Ad Manager page walks the line items the key-values target. The dashboard reports impressions, revenue, eCPM and fill rate, updated as traffic arrives.
Checklist
- Queue calls on
pbjs.que, hold the ad server's first call, and letinitAdserverrun exactly once. - One ad unit per placement, one bidder entry per demand partner, media types declared on every unit.
- Build line items to match the granularity exactly, with two decimal places in every value.
- Set
bidderTimeoutfrom the page's budget, and the server-side timeout below it. - Configure the consent module before the auction, and let id modules run only with consent.
- Keep ads.txt in step with the partners in the build, and upgrade majors at least every six months.
Checked against
- Prebid.org, Introduction to Header Bidding, for what Prebid is, the role of adapters, and the upgrade cadence.
- Prebid.org, Prebid.js basic example and the publisher API reference (setConfig, requestBids), for the order of operations and the configuration options.
- Prebid.js source, src/config.ts and src/cpmBucketManager.ts, for the default timeout, the default send-all-bids flag and the price bucket definitions.
- Prebid.org ad ops pages: Price Granularity, Ad Server Key Values, Line Item Considerations, for the buckets, the hb_ keys and the Google Ad Manager line item guidance.
- Prebid.org, Prebid Server overview and the Prebid Server bid adapter page, for the server-side setup and timeouts.
- Prebid.org, consentManagementTcf and userId module pages, for consent and identity behaviour.
- Prebid.org, Prebid.js release notes for 9.0, 10.0 and 11.0, and the release list on GitHub, for the current version and the changes per major.