Between Digital


Using Prebid.js with Google DFP

Step 1: Building Prebid.js

Option 1: on Prebid.js website. Go to prebid.org/download.html , choose BetweenDigital's adapter, press the button «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 with Google DFP

The parameters are used as an example:

You can also specify several sizes in the mediaTypes.banner.sizesparameter, for example:

        
mediaTypes: {
  banner: {
      sizes: [[240, 400], [300, 250], [300,600]],
  }
}, 
        
      

  1. Pre-configure the Google DFP by following instructions
  2. Include into <head> builded prebid.js: <script src="prebid.js></script>
  3. Include into <head> following code:
  4.     
          
          
          
          
          
          
          
        
      
  5. Include into <body> following code:
  6.     
    

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="ru">
<head>
<script type="text/javascript" 
    src="https://cdnit1.img.sputniknews.com/min/js/libs/prebid.js?270f2d7ce">
</script>

<script>
  var PREBID_TIMEOUT = 1000;
  var adUnits = [{
    code: 'div-gpt-ad-1576579925364-0',
    sizes: [[240, 400]],
    bids: [
    {
      bidder: 'between',
      params: {
        s: 3649326,
        cur: 'EUR'
      }
    }
]
}];

  var pbjs = pbjs || {};
  pbjs.que = pbjs.que || [];

  pbjs.que.push(function() {
  pbjs.setConfig({
    priceGranularity: {
      "buckets": [{
          "precision": 2,
          "min": 0,
          "max": 10,
          "increment": 5.00
      }, {
          "precision": 2,
          "min": 10,
          "max": 20,
          "increment": 10.00
      }, {
          "precision": 2,
          "min": 20,
          "max": 100,
          "increment": 20.00
      },{
          "precision": 2,
          "min": 100,
          "max": 200,
          "increment": 50.00
      }, {
          "precision": 2,
          "min": 200,
          "max": 600,
          "increment": 200.00
      }]
  }
  });
});

</script>

<script>
  var googletag = googletag || {};
  googletag.cmd = googletag.cmd || [];
  googletag.cmd.push(function() {
    googletag.pubads().disableInitialLoad();
});

  pbjs.que.push(function() {
    pbjs.addAdUnits(adUnits);
    pbjs.requestBids({
      bidsBackHandler: sendAdserverRequest
  });
});

function sendAdserverRequest() {
  if (pbjs.adserverRequestSent) return;
    pbjs.adserverRequestSent = true;
    googletag.cmd.push(function() {
      pbjs.que.push(function() {
        pbjs.setTargetingForGPTAsync();
        googletag.pubads().refresh();
    });
  });
}
setTimeout(function() {
        sendAdserverRequest();
}, PREBID_TIMEOUT);
</script>

<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>

<script>
  window.googletag = window.googletag || {cmd: []};
  googletag.cmd.push(function() {
    googletag.defineSlot('/21757675864/240_400', [240, 400], 'div-gpt-ad-1576579925364-0').addService(googletag.pubads());
    googletag.pubads().enableSingleRequest();
    googletag.enableServices();
  });
</script>

</head>
<body>
  <div id='div-gpt-ad-1576579925364-0' style='width: 240px; height: 400px;'>
  <script>
    googletag.cmd.push(function() { googletag.display('div-gpt-ad-1576579925364-0'); });
  </script>
  </div>
</body>
</html>