Skip to main content

Prebid.js

Prebid.js is a feature-rich header bidding platform for the web, including more than 150 demand sources and 15 analytics adapters. It supports currency conversion, GDPR, common ID systems, and multiple ad servers.


Use prebid.js with Appconsent CMP

  1. Add the AppConsent CMP code to your website

  2. Download the prebuild version on https://docs.prebid.org/download.html or build it yourself from https://github.com/prebid/Prebid.js

  3. Place your prebid.js file in your web directory

  4. In your website, add the following configuration script for prebid.js, with the consentManagement configuration (Take care of loading this script before loading the cmp snippet):

<script>
var PREBID_TIMEOUT = 300;
var pbjs = pbjs || {};
pbjs.que = pbjs.que || [];
pbjs.que.push(function()
{
pbjs.setConfig({consentManagement:
{ cmpApi: 'iab', //needs to be iab
timeout: 8000, //timeout for prebid to wait for consent in ms
allowAuctionWithoutConsent: false //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.addAdUnits(units);
pbjs.timeout = 300;
pbjs.requestBids({ bidsBackHandler: function(bidResponses){ }, timeout: 300 });
});
</script>
Allow auction with or without consents

In this code, allowAuctionWithoutConsent is false. Meaning that requests will not be sent without consent. If you want to send requests without consent, set it to true

info

If you are using Tag commander or GTM, please refer to your Prebid representatives to ask them the best way to implement the script.