Um das CMP mit prebid.js zu verwenden, müssen Sie prebid.js in Version 1.0 oder höher einbinden (Version 0.3x von prebid.js unterstützt keine CMPs). Du kannst die vorgefertigte Version unter http://prebid.org/download.html herunterladen oder sie selbst erstellen (Download unter https://github.com/prebid/Prebid.js, Erstellung über gulp build –modules=consentManagement,bidAdapter1,bidAdapter2,…).
- Fügen Sie den normalen CMP-Code zu Ihrer Website hinzu
- Legen Sie die Datei „prebid.js“ in Ihrem Webverzeichnis ab und fügen Sie die Konfigurationsskripte für „prebid.js“ zu Ihrer Website hinzu
- Füge der normalen prebid.js-Konfiguration wie folgt eine prebid.js consentManagement-Konfiguration hinzu:
<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>