What Is Header Bidding And How To Implement It

Posted by

[]The header bidding innovation started to establish in 2015, and has actually because assisted lots of publishers to grow their profits by as much as 40% (and even, in some cases, to levels of 100% or more.)

What Is Header Bidding?

[]Header bidding is an innovative strategy where publishers provide their ad stock to lots of ad exchanges, also called Supply-Side Platforms (or SSPs), concurrently prior to making calls to their advertisement servers.

[]Here are the actions a publisher needs to pass to have this technology power up its money making.

  • Apply to SSP partners and get approval.
  • Carry out Prebid.JS on site.
  • Configure ad server.
  • Select an approval management system.
  • Test and debug.

Applying To SSP Partners

[]There are numerous SSP partners available in the list to use, but I would like to mention what I think to be the most popular ones:

  • TripleLift.
  • Index Exchange.
  • Amazon UAM/TAM.
  • Xandr (formerly AppNexus).
  • Teads.
  • Pubmatic.
  • Sovrn.
  • Verizon.
  • Magnite (formerly Rubicon).
  • OpenX.
  • Sonobi.
  • GumGum.
  • Sharethrough.
  • Unurly.

[]One needs to find their online application form and pass through the company’s verification procedure. For instance, when it comes to Xandr, the contact page looks like this:

Screenshot from Xandr, December 2022 Focus on the []minimum inventory size needed to be eligible for using. Yes, that is an incredible high of 50M ad impressions a month. You may need quite an outstanding website to be able to use to some of the advertisement networks. We will call them additional bidders, as they bid on stock in real time. Nevertheless, not all SSPs have such high limits for application.

[]For example, Sharethrough just requires 20M advertisement impressions. Besides, they consider also audience quality, traffic geolocation, how much time users invest in the website, etc. It typically takes a few weeks after applying to be approved and onboarded

[]with them, so it can be a relatively time-consuming process that might even take months to complete. How Does Prebid.js Work? In nutshell, here is how Prebid.js works. When a user opens a webpage, an advertisement demand is made to all bidders(SSP partners). Bidders react with their CPM bids– let’s say$1

[]and$ 1.50– and Prebid.js makes a demand to the ad server, with the highest

[]CPM targeting. In this case, that would be $1.50. At the advertisement server, in our case, Google Advertisement Manager, the demand is gotten and it understands that somebody is

[]paying $1.50 USD CPM for an ad. It runs another auction with Google Adsense or AdX. If Google provides a greater CPM, then the Google Advertisement will be served. If not, our ad with $1.50 CPM will win, and be served

[]by our SSP partner. Screenshot from Google Ad Manager, December 2022 The technique here is that auctions occur in real-time, which creates purchasing pressure on Google AdX to pay the greatest

[]CPM possible. If Google AdX does not have any competitors, it will provide the most affordable CPM possible– as it wishes to buy inventory for the most affordable cost

[]possible. With header bidding, bidders are able to complete and press CPMs (and therefore profits) up. There are two methods to implement header bidding

[]: Client-side: When the auction runs through JavaScript in the browser. Server-side: When the auction is

[]worked on the server. Let’s discuss client-side header bidding. How To Execute Client-Side Header Bidding In order to establish header bidding, we need to implement Prebid.js on our site and configure our

[]Google Advertisement Manager(or ad server).

Execute Prebid.js On Your Website Prebid.js []is a header bidding platform that has more than 200 need sources integrated. You require to select the SSP partners you are working with

from the customize page and download the library []constructed for your specific setup. Don’t forget to choose Approval Management modules to comply

[]with GDPR and GPP privacy standards. Below is the sample code taken from the official documentation. var div_1_sizes=[ [300, 250]

[], [300, 600]]; var div_2_sizes= [[

[]728, 90], [970, 250]]

Basic Prebid.js Example



[]Let’s break down the code above.

  • The very first lines fill all required JS files and our customized Prebid.JS file.
  • Ad slots are defined in the adUnits selection variable.
  • In the adslot definitions, you can see the SSP partners’ names and IDs you will be provided when onboarding when them.
  • googletag.pubads(). disableInitialLoad(); is called to disable advertisement demand to be sent to Google Ad Manager till Prebid.js completes the auction.
  • pbjs.requestBids operate calls SSP partners and identifies the winner.
  • initAdserver() function is contacted us to send an advertisement demand to the Google Ad Manager with hb_pb secret, which contains the winning CPM value, e.g. hb_pb=”1.5 ″. (This action is connected with establishing Google Advertisement Supervisor in the next step.)
  • When Google Advertisement Manager gets the demand with the winning quote, it runs its own auction in Google AdX, and returns either the AdX advertisement with a higher CPM, or the ad of the winning SSP.

[]For your particular case, you might require to code differently and change the setup, but the principle stays the very same.

[]Aside from that, I would like to rapidly review how to carry out lazy loading, because it is a bit various.

How To Implement Lazy Loading

[]The Google tag for publishers has a lazy loading structure which will not work in the case of header bidding.

[]This is due to the fact that you require to run an auction, and identify and set crucial values before sending out a demand to the advertisement server.

[]Because of that, I would advise using the Crossway Observer API to figure out when to fill the ad in the HTML

tag when it will participate in the viewport.

options = margin around root. Worths resemble css residential or commercial property. Unitless worths not permitted threshold: 0; your_observer = brand-new IntersectionObserver( observer_handler, alternatives ); your_observer. observe( goog_adslots [i]; []In the observer_handler recall function, you can run the prebid auction and call the ad server.

function observer_handler( entries, observer) 1055389 function lazySlotPrebid(slot, div_id) // endd of initDynamicSlotPrebid []Now, let’s get on setting up the advertisement server using Google Advertisement Manager.

How To Set Up GAM For Header Bidding

[]Ad servers require to have dozens of price priority line products with essential hb_pb targeting all possible CPM values, such as hb_pb=0.04, hb_pb=0.03, and so on hb_pb essential value targeting

[] This is the bottom line that makes the header bidding engine work. The auction runs in the internet browser on page load.

  • The winning SSP partner is sent to GAM with a crucial worth targeting hb_pb = 2.62.
  • Since the order has the same CPM value, GAM comprehends that there is a quote at $2.62.
  • GAM runs an AdX auction and has to pay more than $2.62 in order to win the quote and show a Google Advertisement.
  • []As I mentioned above, you would need to develop line items in GAM with particular granularity, say 0.01– and for the CPM range $0-$20, you would require to develop 2,000 line products, which are difficult to do by hand.

    []For that, you would need to utilize GAM API.

    []Sadly, there are no strong services that you can simply download and run in one click.

    []It is a rather complicated job, however thanks to contributors who built API tools (despite the fact that they are not actively supporting them), we can still customize it a little and make it work.

    []Let’s dive into how to set up Google Advertisement Manager and understand the following:

    Step 1: Allow API Access

    []In the Google Advertisement supervisor Global > General settings area, ensure API access is allowed.

    []Click on the Add service account button and create a user with the sample name “GAM API USER” and email “[email protected]” with admin rights.

    Screenshot from Google Advertisement Manager, December 2022 Step 2: Produce A New Job

    Navigate to Google API Console

    []Credentials page. From the project drop-down, select Produce

    []a new job, enter a name for the project, and, optionally, modify the offered Job ID. Click Produce.

    []On the Credentials page, []select Produce credentials, then choose Service account secret.Select New service account, and choose JSON

    []. Click Create to download a file containing a personal secret. Screenshot from Google API Console Qualifications page, Deccember 2022 Screenshot from Google API Console Qualifications page, Deccember 2022 Complete the service account details you have actually created above. Appoint the function “owner” and produce the service account OAuth2 qualifications. Then, click the produced user and produce JSON type key, and download it. Screenshot from Google API Console Credentials page, Deccember 2022 Step 3: Download Job Download the project zip file and

    unzip it, directory site(additionally, you can utilize the git command tool to clone the repo). Install author for your os in order to construct the task. Step 4: Modification your PHP.INI Change your php.ini( located at/ xampp/php/php. ini)file and make it possible for”

    []extension=soap”by getting rid of”;” in front of and set”soap.wsdl _ cache_ttl=0″ and reboot Apache from the control panel of XAMPP. Step 5: Develop Subfolders And Build The Project When you have everything established

    and unzipped, open composer.json file and modification”googleads/googleads-php-lib”:”^ 44.0.0 “to use the current version” googleads/googleads-php-lib “:”^ 59.0.0″. Check for the most fresh version at the minute you perform this. Browse and change in/ app []/ folder of the task”v201911″with” v202202″, because that git task was

    []n’t upgraded because 2019, to utilize the current version path of libraries. Open the command line of your PC and switch to the directory site where you’ve unzipped the files(utilizing cd command or right-click inside the folder” Git bash here “if you have actually git installed), and run composer upgrade in the PC terminal or git terminal. It will develop subfolders and develop the job. Action 6: Set Up Your Google Advertisement Manager Credentials Move the downloaded JSON secret “gam-api-54545-0c04qd8fcb. json” file into the root folder of

    the project you’ve developed. Next, download adsapi_php. ini file []and established your Google Ad Manager qualifications in it. networkCode= “899899” applicationName =”My GAM APP” jsonKeyFilePath=”

    []D: xampp htdocs dfp-prebid-lineitems gam-api-54545-0c04qd8fcb. json”scopes=”https://www.googleapis.com/auth/dfp” impersonatedEmail =” [email protected]m”jsonKeyFilePath is the absolute directory path to the JSON essential file in the folder root. Step 7: Set The Content Of The File Lastly, browse to the file/ script/tests/ConnexionTest

    []. php and set the content of the file like below: putenv(‘ HOME =’. dirname( __ DIR __ ).

    “/./” ); need __ DIR __.’/./ []./ vendor/autoload. php’; $traffickerId=(brand-new App AdManager UserManager ()) -> getUserId (); if(is_numeric($traffickerId))echo” n====Connexion okay=== = n n”; else In your terminal(or git celebration console) test the connection by running the command(if you are in the/ script/tests/ folder). php ConnexionTest.php You need to see a message”= == =Connection OK====” Step 8: Configure The Parameters Browse to the

    file/ script/tests/ConnexionTest. php in your task and open it. Copy and paste the below code into that file, and set up the parameters in the $entry and$buckets arrays per your requirements.

    []putenv(‘ HOUSE= ‘. dirname (__ DIR __).”/./”); need __ DIR __.’/././ vendor/autoload. php ‘; usage App Scripts HeaderBiddingScript;$bucket_range=range(); $Your_Advertiser_Name=’Sample_Advertiser’; $containers=[“pails”=> [[‘accuracy’=> 2,’minutes ‘=> 0,’max’= > 4.00,’increment’= > 0.01], [‘ accuracy ‘= > 2, ‘min’ => 4.01, ‘max’ => 8.00, ‘increment’ => 0.05],]]; foreach ($ containers [” containers”] as $k => $bucket)

    []Additionally you can likewise specify ‘geoTargetingList’ => “dz, pk, ke, pt” or customized crucial worth targeting customTargeting’ => [‘ amp_pages’ => yes’] if you want your header bidding to work only when the custom essential worth is set.

    []Run the command below and it will begin developing line items per the bucket settings you’ve specified.

    []php ConnexionTest.php

    []There is a tool utilizing Python that is used similarly; you may want to provide it a shot as well.


    []For debugging, there are a few internet browser add-ons you can utilize to see if the auction runs without errors.

    []Additionally, open your webpage URL using “/? pbjs_debug=real” specification at the end of the URL, and see console logs messages.

    []You need to make sure that hb_pb key values are passed to Google Advertisement Supervisor. Usage “/? google_console=1” at the end of the URL to open the GAM console, and click “Delivery Diagnostics” of each ad unit.

    []You need to see that hb_pb values are set and passed to the ad server.

    Screenshot from Google API Console Credentials page, Deccember 2022

    Pick A Consent Management System

    []Users’ personal privacy is one of the most essential factors, and you wish to make certain that you adhere to both GDPR and GPP.

    []The in-depth guidelines on how to set up an authorization management system in your wrapper are here.

    []There are lots of companies which adhere to IAB’s most current standards, and here are a few of the most popular ones:


    []You may discover it unexpected that setting up header bidding involves so many steps, but it is really worth it to execute. It can easily increase your earnings by +30% or more by creating selling pressure on Google Advertisements.

    []This guide is for technically savvy users– however if you have questions and issues, there is an Adops slack channel you might subscribe to and ask questions to the community.

    []I hope that after reading this short article, you will discover it easier to set up header bidding and boost the monetization of your site.

    []More resources:

    []Featured Image: Best SMM Panel