Prebid Wrapper: A Comprehensive Guide for Publishers

Updated on: January 9, 2024
Running an open source header bidding auction for your site? Trying to figure out how to use Prebid’s Wrapper? We can help.

As you’re here, we assume you are familiar with header bidding and how the header auction happens on a website. If not, we strongly suggest you learn it; we’ll use it often.

Header bidding can be implemented in more than one way. For instance, you can pair up with a managed header bidding provider who provides you with a wrapper – which, in turn, helps you run client-side/server-side header bidding seamlessly. The managed header bidding provider will typically have direct relationships with SSPs and agencies to bring demand for your impressions. 

Or you can also use open-source repositories like Prebid to run header bidding. This piece will focus on the Prebid wrapper, a community-powered header bidding wrapper for publishers.

What Is a Header Bidding Wrapper?

To put it simply, the wrapper is simply a container (like a Google Tag Manager) that can help you facilitate bids from different header bidding partners for sending it down to the ad server.

The ad server will get the bids and then decides on the winner. So, the primary function of the wrapper is to manage multiple demand partners and get bids from them for every impression.

Before diving into the specifics of a wrapper, you need to know why there’s a wrapper in the first place. Imagine a scenario where a header bidding partner (for instance, OpenX) would like you to connect with you, and if they’re the first one, you can just place their JS code on your pages. Sounds simple, right?

What if there’s another header bidding partner with its demand and wants to compete for your impressions? The situation worsens as the demand for your impressions increases – a bunch of codes, hard-to-experiment setup, limited customization, discrepancies, and so on. 

The wrapper is a tag management system with features that help you seamlessly run, test, and optimize header bidding. How? It connects multiple demand partners rather than forcing you to set up/run auctions for all the demand partners. You can use a single wrapper and connect to the supported demand partners.

What Is a Prebid Wrapper (or Prebid.js)?

Prebid wrapper, also known as prebid.js, is one of the open-source frameworks available to let web publishers and app developers set up and run header bidding themselves. It has 150+ demand partners, 15+ analytics adapters, and built-in modules to help you with currency conversion, GDPR, and common ID systems.  

How Does It Work?

Let’s see how Prebid works on a higher level. 

If there’s no header bidding or Prebid wrapper tag, the ‘ad tag’ on the page will send ad requests to your ad server whenever a user loads a page. But with the Prebid wrapper tag, the ad server code is paused, allowing the prebid.js (Prebid wrapper) to fetch bids and creatives from various demand partners. 

The wrapper doesn’t interfere with the ad server. It puts all the demand partners on an equal footing by sending requests randomly. There’ll be a timeout to ensure page load time is optimal. The bidders who return bids within that range will get the chance to compete. 

The information about those bids will be sent to the ad server via the ad server’s tag on the page. The bids will match your created line items and enable them to compete. Finally, the ad server picks the winner. 

If a bid from a prebid wrapper wins the impression, the ad server returns a signal to the wrapper to render the winner’s ad creative to the user. If not, the ad server will render the winner’s ad creative to the user. 

How to set up a Prebid wrapper on your website?

You probably might have guessed by now that we require engineering and adops teams to set up header bidding with Prebid. 

Though other proprietary wrappers are different, the overall logic remains the same. In Prebid, you are required to do everything. When it comes to managed header bidding providers and proprietary wrappers, they’ve developed a wrapper and likely put automation in place to take care of the setup for you.

Benefits of Prebid Wrapper for Publishers

One of the great things about Prebid.js is that it allows publishers to control the bidding process. You can control the rules, prices, bid limits, etc. But the Prebid wrapper goes a step further. The benefits of using a prebid wrapper for publishers include the following:

  • Smoother header bidding experience: Implementing the Prebid wrapper results in a more streamlined header bidding, resulting in improved response times of demand partners, reduced latency, and an enhanced user experience of a website.
  • Extensive collection of header bidding adapters: Publishers can utilize the vast array of functional header bidding adapters along the Prebid wrapper to leverage multiple demand sources and analytics, enhancing auction performance and maximizing revenue opportunities.
  • Greater control of ad inventory: Prebid facilitates more control of ad inventory, allowing publishers to manage their ad inventory better and make informed decisions on which ads to show to their audience on the website.
  • Free and open source: It is a free and open-source solution that enables anyone to contribute or review code, ensuring that the available solutions remain up-to-date, relevant, and transparent.

So, How Will You Set Up Prebid to Run Header Bidding?

You need to use developers for setting up the wrapper and adding prebid code on your pages, and then take help from adops engineers to set up and configure the ad server to work with the prebid wrapper. 

While we can’t list all the tasks/steps involved in detail, we’ll give you an overview of the steps that should be taken in the prescribed order to run header bidding via Prebid efficiently.

Let’s start with the prebid wrapper. Shall we?

Step 1: Prebid library file

Prebid.js, a library file, should be loaded initially to run header bidding. You can head to and download the library file. Before downloading, you must select the version and the adapters (demand partners/header bidding partners) you want to work with. There’s a caveat – you must ensure the Prebid adapter and the Prebid version support each other to avoid errors. 

The library file has the core logic (wrapper code) to run header auctions. 

Step 2: Ad server library file

The very next step is to load the ad server’s library file. You can call the GPT (Google Publisher Tag) library file using Google Ad Manager. Prebid.js supports Google Ad Manager, FreeWheel, Xandr, etc. 

Step 3: Header auction

To run header auctions, Prebid will pause the initial ad server call. Then, it will send bid requests to multiple demand partners to fetch bids for the available impressions. These should be done by writing the code with appropriate functions (from the library files).

You can make the request asynchronous (it doesn’t block the rest of the page content), set a timeout (to ensure the wrapper isn’t waiting forever to get the bids from the partners), and make use of modules (GDPR consent management module). 

On top of these, you can configure the prebid.js to send all the bids from the demand partners to the server instead of only sending the highest bids (the decision logic of choosing the highest bid is customizable). 

Sidenote: A publisher needs technical assistance to go through this process. It is advised to either have a dedicated in-house team to use the prebid wrapper or use a managed header bidding provider

Ad server setup varies based on the server you use. For Google Ad Manager, you must create line items and key values for the demand partners you want to capture bids from. The configuration requires due diligence since the first-price auction and Google’s unified pricing rules are applied for indirect demand. We’ll cover it in detail in a separate post. We hope you know about header bidding wrappers, especially prebid wrappers.

Prebid Vs. Managed Header Bidding Wrapper: Which One Should You Choose

Building a wrapper and maintaining it isn’t an easy job. Besides, you are required to onboard SSPs and other demand sources yourself. 

On the one hand, proprietary wrappers raise concerns among publishers for the lack of transparency and black-box technology. On the other, developers struggle to make use of open-source frameworks. The plethora of errors and back-and-forth communication between you and the demand partners makes it even harder*.

*Most global SSPs, like OpenX, Xandr, Magnite, etc., tend to onboard premium publishers with hundreds of millions of monthly ad impressions.

That’s why many managed header bidding providers came up with wrappers – built on top of prebid. This way, publishers can trust the wrapper, save many resources and hours, and focus on what they do best – creating stellar content, attracting the audience, and delivering the best user experience. Ultimately, it depends on your team and resource availability.

You can go with a Prebid wrapper if you have an in-house team for setup and optimization. It has all the features you require to get started with header bidding. The next best option is to try a managed header bidding solution provider. The best part is you’ll outsource almost all the setup and optimization work to the provider. Have any questions regarding prebid/header bidding? Ask us right away.

Frequently Asked Questions

How Does Prebid Wrapper Work?

If there’s no header bidding or prebid wrapper tag, the ‘ad tag’ on the page will send ad requests to your ad server whenever a user loads a page. But with the prebid wrapper tag, the ad server code is paused, allowing the prebid.js (prebid wrapper) to fetch bids and creatives from various demand partners. 

Does Prebid.js or Prebid Wrapper Cache Bids?

Yes, It can. Prebid.js version 1.x would cache the bids under limited circumstances. But, in the prebid.js 2.0 & later versions, publishers can enable the cache functionality by enabling the “useBidCache” option. 

What Are the Common Issues with Prebid.js?

Price granularity mismatch, non-prebid line items are at a higher priority, and bids are returning, but ads don’t appear.

News and Tips for Publishers

Get the inside scoop on publishing and programmatic with our 5-minute newsletter.