Easy Steps for Prebid.js

Steps for Prebid.js

For the benefit of publishers we have already hosted build prebid.js. Following are the easy steps to start prebid.js:

  1. Create a prebid.js file with the chosen list of header bidding partners
  2. You can download the prebid.js from this link – https://prebid.org/download.html
  3. Upload the prebid.js file on your website or other server
  4. In the page header code, specify the domain in the pbs.src code
    For example: pbs.src = ‘//abc123.com/prebid.js’;


A) Add the following code in the page header:

Code Snippet:

Head Tag

<script>

(function()

{

  var d = document, pbs = d.createElement(‘script’), pro =

  d.location.protocol;

  pbs.type = ‘text/javascript’;

  pbs.src = ‘//test1.incrementx.com/build/dev/prebid.js’;

  var target = document.getElementsByTagName(‘head’)[0];

  target.insertBefore(pbs, target.firstChild);

})();

  var pbjs = pbjs || {};

  pbjs.que = pbjs.que || [];

   pbjs.que.push(function() {

  var adUnits = [{

  code: ‘vz_hb_slot1’,

  sizes: [[300, 250]],

  bids: [{

  bidder: ‘appnexus’,

  params: { placementId: ‘4799418’ }

  },

  { bidder: ‘incrementx’,

  params: { placementId:’VZ-HB-M853211V2DED19′ }

  }]

  },

{

  code: ‘vz_hb_slot2’,

  sizes: [[300, 250]],

  bids: [{

  bidder: ‘appnexus’,

  params: { placementId: ‘4799418’ }

  },

  { bidder: ‘incrementx’,

  params: { placementId: ‘njkn’ }

  }]

  }];

  pbjs.addAdUnits(adUnits);

  pbjs.requestBids({

  bidsBackHandler: function(bidResponses) {

  var targetingParams = pbjs.getAdserverTargeting();

   //—object based on div—–//

  var adSpaceSlot1=targetingParams.vz_hb_slot1;

  var adSpaceSlot1=targetingParams.vz_hb_slot2;

  // ———extract ad id —- //

   var adid1= adSpaceSlot1.hb_adid;

  var adid2= adSpaceSlot2.hb_adid;

         //create frame to display repeated for frames

  //to display ads on server

  var frame1 = document.getElementById(‘vz_hb_frame1’);

   frame1.contentWindow.document.open(‘text/html’,’replace’);

  frame1.contentWindow.document.write(‘<script>var curr_w = parent.window;console.log(‘+'”‘+adid1+'”‘+’);for (i = 0; i < 10; i++)

{ try {curr_w.pbjs.renderAd(document, ‘+'”‘+adid1+'”‘+’); break;}catch(e) {console.log(e.message);continue;}}</s’+’cript>’);

frame1.contentWindow.document.close();

   }

  });

  });

 </script>

B) Add the following code in the page body:
Code Snippet:
Body Tag:

<div id = “vz_hb_slot1”>

<iframe id=”vz_hb_frame1” src=”javascript:'<html><body></body></html>’frameborder=”0marginwidth=”0marginheight=”0scrolling=”NOwidth=”300height=”250></iframe>

</div>

 <div id = “vz_hb_slot2”>

<iframe id=”vz_hb_frame2” src=”javascript:'<html><body></body></html>’frameborder=”0marginwidth=”0marginheight=”0scrolling=”NOwidth=”300height=”250></iframe>

</div>

Related Articles

IncrementX – Google Ad Manager Integration Guide

Step 1 - Ad Unit Creation (Go to Inventory -> Ad Units -> New Ad unit) In the Settings section Parent Ad unit should be “Top Level” Name will be the Ad Unit name which can be easily identified (Eg: websitename.com_IncrementX_300x250) Code is used to identify the...

Ads.txt – Implementation Guide

This document outlines the significance,purpose and acts as guide to implement Ads.txt for your IncrementX account. 1) What is Ads.txt? Ads.txt is a simple, flexible, and secure method for publishers and distributors to declare who is authorized to sell their...

Site and App Report

Sites & Apps Reports displays a detailed report on the sites and apps transactions done by the publishers. The Sites & Apps Reports display the Action, Date, Impressions, eCPM($), and Estimated Revenue($). The above is an example of  a Site and App Report, The...

Add New Ad Unit

After successfully adding Site & Apps, the Publisher can now start Adding New Ad Units by performing these simple steps: Click on Ad Unit Management, from the Sites & Apps menu as highlighted in the figure below. Click on +Add New Ad Unit. Once you have...

Sign Up for Publishers

In order to Monetize with IncrementX, as a Publisher, you can create a New Acount by Signing Up, which can be done in 2 ways : Either by clicking on the Getting Started or by Clicking on the Sign Up option on the top right corner of the page, both of the options are...

Add New Site & App

As a Publisher, you can Add New Site & App  by performing the following steps. From the Site & Apps menu, click on Add New Site and App and the following figure will be displayed: IncrementX lets the Publisher choose the Product Type,  which can be...

Mobile App Creation API

App: Add Mobile App: Add Mobile App helps you to add new Mobile app as well as adunits with different sizes.  Method: POST URL: https://api.incremntx.com/ip/addwebsitenapp In request there are two objects wrapped one is Website and the other is ad unit. Request Fields...

Vast Site Creation API

VAST: Add Vast Site: Add Vast App helps you to add new Vast site's with different VAST versions. Method: POST URL: https://api.incremntx.com/ip/addwebsitenapp For request there are two objects wrapped one is Website and the other is ad unit. Request Fields Parameters...