What is Prebid.js?
Prebid.js is the open-source JavaScript library that runs client-side header bidding in the user’s browser. It holds a unified auction across your connected demand partners, collects their bids before the ad server is called, and passes the winning bid into the server to compete with your other demand. It’s the de facto standard for web header bidding — free, transparent, and vendor-neutral.
Because it’s open source and widely adopted, Prebid.js has a huge ecosystem of demand-partner adapters and is well-documented — which is exactly why so many publisher stacks are built on it.
How Prebid.js works, step by step
- The page loads and Prebid.js requests bids from each configured demand partner (each has an “adapter”).
- Bids come back within a set timeout window.
- Prebid runs the auction and picks the highest bid per ad slot.
- The winning bids are passed as key-values into the ad server (usually Google Ad Manager).
- The ad server makes the final decision, letting header-bidding demand compete with AdX and direct deals on equal footing.
What a clean setup involves
A production Prebid setup is more than pasting code. The pieces that matter:
- Ad units and slots. Define each ad position and the sizes it accepts (see banner ad sizes).
- Bidder adapters. Configure each demand partner with the parameters they require.
- Timeout. The single most important dial — how long to wait for bids. Too short cuts off good bids; too long hurts page speed. This is a balance you tune, not set once.
- Ad server line items / targeting. Google Ad Manager needs price-bucket line items so it can read Prebid’s bids and let them compete.
- User-sync and consent. Handle cookie syncing and privacy/consent signals correctly.
Performance is part of correctness
Because Prebid runs in the browser, a careless setup can hurt Core Web Vitals:
- Load Prebid asynchronously so it doesn’t block rendering.
- Keep the partner list disciplined — each adapter adds weight, so favor the right partners over the most (see client-side vs server-side for offloading the long tail server-side).
- Lazy-load below-the-fold slots so their auctions fire only when needed.
- Tune the timeout against real page-speed and bid-rate data.
Prebid client-side vs Prebid Server
Prebid.js runs in the browser; Prebid Server runs the same auction server-side for scale. The common pattern is a hybrid: a few high-value partners in Prebid.js client-side, the long tail via Prebid Server — capturing broad demand without piling scripts onto the page.
The bottom line
Prebid.js is the open-source engine of modern web header bidding: a transparent, unified auction across many demand partners, run in the browser. A good setup is as much about operation — timeouts, ad-server line items, partner discipline, page performance — as about installation. Because that operation is continuous, many publishers run Prebid through a managed ad monetization platform rather than maintaining it in-house. Either way, a well-tuned Prebid setup is one of the highest-impact upgrades available for web yield optimization.