1 0 6000 0 600 120 30 https://headerbidding.co 960 0

Prebid Wrapper (Prebid.js) – A Complete Guide for Publishers

Prebid Wrapper
With the increased adoption of header bidding, publishers needed a reliable and quick way to experiment with several header bidding partners. That's where a wrapper comes in. Let's learn what are they and how to get one for your site.

As you’re here, we assume that you are familiar with header bidding and how the header auction happens on a site. If not, we strongly suggest you learn it; we’ll be using 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 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/or agencies to bring demand for your impressions. 

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

Table of Contents

But wait? What’s a header bidding wrapper?

Good question. 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 the winner. So, the primary function of the wrapper is to manage multiple demand partners and get bids from them for each and 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?

Now, what if there’s another header bidding partner with its own demand, wants to compete for your impressions? The situation gets worse as the demand for your impressions increases – a bunch of codes, hard-to-experiment setup, limited customization, discrepancies, and the list goes on. 

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

What’s 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 comes with 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, whenever a user loads a page, ‘ad tag’ on the page will send ad requests to your ad server. 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. 

Sidenote: The wrapper doesn’t interfere with the ad server. It just puts all the demand partners on an equal footing by sending out ad requests almost simultaneously (in random order). There’ll be a timeout to ensure page load time is optimal. The bidder partners who return bids within that range will get the chance to compete for the impression. 

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 with line items that you’ve created and enable them to compete. Finally, the ad server picks the winner. 

If a bid from a prebid wrapper won 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 site?

By now, you probably might have guessed that we require both 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.

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 out all the tasks/steps involved in detail, we’ll try to give you an overview of the steps that should be taken in the prescribed order to efficiently run header bidding via prebid. 

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 prebid.org and download the library file. Before downloading, you need to select the version and the adapters (demand partners/header bidding partners) you want to work with. There’s a caveat – you need to ensure the Prebid adapter and the prebid version support each other to avoid any 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 ad server’s library file. If you’re using Google Ad Manager, you can call the GPT library file. Prebid.js supports Google Ad manager, FreeWheel, AppNexus, and Smart ad server. 

Step 3: Header auction

In order 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 (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 DFP, you need to create line items and key values for demand partners you want to capture bids from. The configuration requires due diligence since the first-price auction and Google unified pricing rules are applied for indirect demand. We’ll cover it in detail in a separate post. We hope you have an idea about header bidding wrappers and especially, prebid wrappers. 

Prebid Vs Managed Header Bidding Wrapper

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

On one hand, proprietary wrappers raise concerns among the publishers for the lack of its transparency and black-box technology, and 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 of the global SSPs like OpenX, AppNexus, Rubicon, etc. tend to onboard premium publishers with hundreds of millions of ad impressions/mo. 

That’s why many managed header bidding providers came up with wrappers – built on top of prebid. This way, publishers can trust the wrapper and save tons and tons of 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.

If you have an in-house team to take care of setup and optimization, you can go with a prebid wrapper. 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, optimization work to the provider. Have any questions regarding prebid/header bidding? We’re here

Frequently Asked Questions

How Does Prebid Wrapper work?

If there’s no header bidding or prebid wrapper tag, whenever a user loads a page, ‘ad tag’ on the page will send ad requests to your ad server. 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 Prbid.js?

  • Price Granularity Mismatch.
  • Non-Prebid line items are at a higher priority.
  • Bids are coming back, but ads don’t show up.
Automatad Team

At Automatad, we help publishers to monetize better without hampering the user experience. Our products are live across hundreds of publishers, earning them incremental ad revenue with every passing second. You can request a free audit to get an estimated revenue uplift today.

Header Bidding
Previous Post
Adtech Weekly Roundup
Weekly Roundup: 100 ...
Sticky Ads
Next Post
Sticky Ads - What Is...
Leave a Reply