Between Digital


Using Prebid.js

Step 1: Building Prebid.js

Option 1: on Prebid.js website. Go to prebid.org/download.html , «Get Prebid.js!» at the bottom of the page.

Option 2: from Github. Go to github and build sources according to instructions.

Step 2: Setup Prebid on a website

The parameters are used as an example:

  1. Include into <head> builded prebid.js: <script src="prebid.js></script>
  2. Include into <head> following code:
  3.     
          
          
          
        
      
  4. Include into <body> this code: <iframe id="ad_slot"></iframe>:

Currency

You can choose in which currency the SSP server will send cpm: 'RUB', 'USD' or 'EUR'. Default is 'RUB'. To do this, in the params field of our adapter you need to add the cur field, which takes one of the values: 'RUB', 'USD' or 'EUR'.

For example, you want cpm to be sent in dollars. Then the code of our adapter settings will look like this:

        
{
 bidder: 'between',
  params: {
   s: 	BETWEEN_SECTION_ID,
   cur: 'USD'
  }
}
        
        

Multisizes

If you specify several sizes in the AdUnits settings in the mediaTypes.banner.sizes field, our SSP server will hold an auction with each size and respond with a bid with the maximum CPM.

For example, your ad-slot supports three sizes: 970x250, 728x90 and 468x60. Then the AdUnits code will look like this:

        
var adUnits = [{
 code: 'ad-slot',
  mediaTypes: {
   banner: {
    sizes: [[970, 250], [728, 90], [468, 60]]
   }
 },
 bids: [
  {
   bidder: 'between',
    params: {
     s: BETWEEN_SECTION_ID,
    }
  }
]
}];
        
      

Full example:

    
      <!DOCTYPE html>
      <html lang="en">
        <head>
          <meta charset="UTF-8" />
          <meta name="viewport" content="width=device-width, initial-scale=1.0" />
          <meta http-equiv="X-UA-Compatible" />
          <title>Prebid Test</title>
          <script src="prebid.js"></script>
          <script>
            var PREBID_TIMEOUT = 1000;
            var adUnits = [
              {
                code: "ad_slot",
                mediaTypes: {
                  banner: {
                    sizes: [[970, 250]]
                  }
                },
                bids: [
                  {
                    bidder: "between",
                    params: {
                      s: 3635454
                    }
                  }
                ]
              }
            ];
            var pbjs = pbjs || {};
            pbjs.que = pbjs.que || [];
          </script>
          <script>
            pbjs.que.push(function() {
              pbjs.que.push(function() {
                pbjs.setConfig({
                  userSync: {
                    iframeEnabled: true
                  }
                });
              });
              pbjs.addAdUnits(adUnits);
              pbjs.requestBids({
                bidsBackHandler: sendAdserverRequest
              });
            });
            function sendAdserverRequest() {
              if (pbjs.adserverRequestSent) return;
              pbjs.adserverRequestSent = true;
              var params = pbjs.getAdserverTargetingForAdUnitCode("ad_slot");
              var iframe = document.getElementById("ad_slot");
              var iframeDoc = iframe.contentWindow.document;
              if (params && params["hb_adid"]) {
                pbjs.renderAd(iframeDoc, params["hb_adid"]);
              }
            }
            setTimeout(function() {
              sendAdserverRequest();
            }, PREBID_TIMEOUT);
          </script>
        </head>
        <body>
          <iframe id="ad_slot"></iframe>
        </body>
      </html>