De CMP gebruiken met prebid.js
Om de CMP met prebid.js te gebruiken, moet je prebid.js bouwen in versie 1.0 of hoger (versie 0.3x van prebid.js ondersteunt geen CMP's). U kunt de voorgebouwde versie downloaden van http://prebid.org/download.html of bouw het zelf (download van https://github.com/prebid/Prebid.js, bouwen via gulp build --modules = consentManagement, bidAdapter1, bidAdapter2, ...).
- Voeg de normale CMP-code toe aan uw website
- Plaats het prebid.js-bestand in uw webdirectory en voeg de configuratiescripts voor prebid.js toe aan uw website
- Voeg een prebid.js toe toestemming Beheer configureren naar de normale prebid.js-configuratie als volgt:
<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: 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.addAdUnits(units);
pbjs.timeout = 300;
pbjs.requestBids({ bidsBackHandler: function(bidResponses){ }, timeout: 300 });
});
</script>