If you've read anything about header bidding, you've met Prebid.js. It's the open-source library most publishers use to run it. This guide covers what it does, the settings that matter, and the mistakes we see most often.
What Prebid.js is
Prebid.js is a free JavaScript library maintained by Prebid.org, an independent industry organisation. It runs in the visitor's browser and handles the auction work before your ad server is called: sending bid requests, collecting responses and passing the results on.
Because it's open source, anyone can read the code, and demand partners contribute their own connectors to it. That openness is a big part of why it became the default choice.
Adapters and modules
Prebid itself doesn't know how to talk to any particular buyer. That's the job of bid adapters. Each SSP or exchange has its own adapter, and you choose which ones go into your build.
Besides bid adapters, there are modules for other jobs, for example:
- Consent management, to pass GDPR and US privacy signals to bidders.
- User ID modules, which share privacy-compliant identifiers with buyers.
- Price floors, to set minimum prices inside Prebid.
- Analytics adapters, to report on bids, wins and timeouts.
You build a custom Prebid file with only the adapters and modules you need. Including everything "just in case" makes the file heavier and the page slower for no gain.
The settings that matter
Most of Prebid's effect on revenue and speed comes down to a few choices.
| Setting | What it does | What to watch |
|---|---|---|
| Timeout | How long Prebid waits for bids before moving on. | Too long slows ads; too short drops valid bids. |
| Price granularity | How bid prices are rounded into buckets sent to the ad server. | Coarse buckets lose money; it must match your ad server setup. |
| Ad units and sizes | Which slots and sizes are offered to bidders. | Sizes must match what the slot can display. |
| Consent | Passes privacy signals to bidders. | Missing consent can mean bidders don't bid at all in some regions. |
How Prebid talks to Google Ad Manager
The common setup passes Prebid's winning bid to Ad Manager as key-values on the ad request. The usual key is hb_pb for the price bucket, plus keys for the bidder and the creative.
In Ad Manager, line items target those key-values. A line item set up for hb_pb=2.40 carries a rate of 2.40, so it competes with Ad Exchange and other demand at that price. If Prebid's bid wins in Ad Manager's auction, a Prebid creative renders the ad from the bidder.
That's why price granularity matters. If your line items only exist in steps of 0.50, a bid of 2.40 gets rounded down to 2.00, and you've given away the difference. Many setups use finer steps at lower prices, where most bids land, and coarser ones above.
Ad Manager also has newer ways to handle Prebid demand that reduce the need for large numbers of line items. Whichever approach you use, the point is the same: the ad server must see the real price as closely as possible.
Common mistakes
- Too many bidders. More isn't always better. Bidders that rarely win still cost page time.
- Outdated versions. Old Prebid builds miss fixes and may not support current privacy rules.
- ads.txt gaps. If a bidder's line isn't in your ads.txt, buyers may treat its inventory as unauthorised.
- Size mismatches. Offering sizes the slot can't show leads to broken or cropped ads.
- No monitoring. Timeouts and win rates drift. Without reporting, nobody notices until revenue drops.
- Layout shift. Slots that don't reserve space push content around when the ad loads. See ads and Core Web Vitals.
Should you run it yourself?
You can. Prebid's documentation is good, and a developer can get a basic setup working. The ongoing part is harder: getting accepted by quality bidders, keeping adapters current, tuning timeouts and floors, and reading the reports.
If you don't have someone who enjoys that work, it's usually better handled by a partner who runs Prebid on many sites and can see what's working across them.
Prefer to leave Prebid to someone else? Bidora runs and tunes Prebid for the sites we manage, alongside Ad Exchange and Open Bidding. Talk to us about joining Bidora MCM.