Using the CMP with prebid.js

In order to use the CMP with prebid.js you need to build prebid.js in version 1.0 or above (version 0.3x of prebid.js don’t support CMPs). You can download the prebuild version from or build it yourself (download from, build via gulp build --modules=consentManagement,bidAdapter1,bidAdapter2,…).

  1. Add the normal CMP code to your website
  2. Place the prebid.js file in your web directory and add the configuration scripts for prebid.js to your website
  3. Add a prebid.js consentManagement config to the normal prebid.js configuration like this:
  var PREBID_TIMEOUT = 300;
  var pbjs = pbjs || {};
  pbjs.que = pbjs.que || [];
    pbjs.setConfig( { consentManagement: 
                     { cmpApi: 'iab', //needs to be iab   
                       timeout: 8000, //timeout for prebid to wait for consent in ms   
                       allowAuctionWithoutConsent: true //send requests without consent?  
    var units = []; 
    units[units.length] = {  
      code: "content",  
      sizes: [[300, 250]],  
      bids: [   
        {bidder: "criteo", params: {zoneId: "..."}},   
        {bidder: "fidelity", params: {zoneid: "...", floor: 0.05, server: "..."}},   
        {bidder: "stroeerCore", params: {sid: "..."}}   
        //more bidders here  
      ] }; 
    pbjs.timeout = 300; 
    pbjs.requestBids({ bidsBackHandler: function(bidResponses){ }, timeout: 300 });
Back to top