CMP not found Canceling auction as per consentManagement config.
Uncaught TypeError: Cannot read property 'apply' of undefined
at y (prebid_gdpr.js:6)
at w (prebid_gdpr.js:6)
at e (prebid_gdpr.js:6)
at vendorConsentsCallback (prebid_gdpr.js:6)
at Object.getVendorConsents (cmp.complete.bundle.js:1)
at e.processCommand (cmp.complete.bundle.js:1)
at cmp.complete.bundle.js:1
at Array.forEach (<anonymous>)
at e.processCommandQueue (cmp.complete.bundle.js:1)
at notify (cmp.complete.bundle.js:1)
If I refresh the page, the "euconsent" cookie is set and the banner is not displayed. After the timeout period, Prebid gives the error:
CMP workflow exceeded timeout threshold. Canceling auction as per consentManagement config.
Error executing bidsBackHandler
How does the CMP plugin "talk" to Prebid? How is the consent passed to the bidders?
I'll leave here the full code that I am trying to run.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Server to Server Test</title>
<script>
(function(window, document) {
if (!window.__cmp) {
window.__cmp = (function() {
var listen = window.attachEvent || window.addEventListener;
listen('message', function(event) {
window.__cmp.receiveMessage(event);
}, false);
function addLocatorFrame() {
if (!window.frames['__cmpLocator']) {
if (document.body) {
var frame = document.createElement('iframe');
frame.style.display = 'none';
frame.name = '__cmpLocator';
document.body.appendChild(frame);
} else {
setTimeout(addLocatorFrame, 5);
}
}
}
addLocatorFrame();
var commandQueue = [];
var cmp = function(command, parameter, callback) {
if (command === 'ping') {
if (callback) {
callback({
gdprAppliesGlobally: !!(window.__cmp && window.__cmp.config && window.__cmp.config.storeConsentGlobally),
cmpLoaded: false
});
}
} else {
commandQueue.push({
command: command,
parameter: parameter,
callback: callback
});
}
}
cmp.commandQueue = commandQueue;
cmp.receiveMessage = function(event) {
var data = event && event.data && event.data.__cmpCall;
if (data) {
commandQueue.push({
callId: data.callId,
command: data.command,
parameter: data.parameter,
event: event
});
}
};
cmp.config = {
//
// Modify config values here
//
globalVendorListLocation: 'https://vendorlist.consensu.org/vendorlist.json',
// customPurposeListLocation: './purposes.json',
// globalConsentLocation: './portal.html',
// storeConsentGlobally: false,
// storePublisherData: false,
// logging: 'debug',
// localization: {},
// forceLocale: 'en-us'
}
return cmp;
}());
}
})(window, document);
</script>
<script src="//acdn.adnxs.com/cmp/cmp.complete.bundle.js"></script>
</head>
<body>
<h1>Server To Server</h1>
<script src="prebid_gdpr.js"></script>
<script>
var pbjs = pbjs || {};
pbjs.que.push(function() {
pbjs.setConfig({
consentManagement: {
cmpApi: 'iab',
timeout: 5000,
allowAuctionWithoutConsent: false
}
});
var adUnits = [
{
"code": "RLFans-Unit1",
"path": "/15188745/RLFans-Unit1",
"safeFrame": true,
"stickyAdPosition": "bc",
"lazyLoad": false,
"sizes": [
[
970,
250
],
[
970,
90
]
],
"bids": [
{
"bidder": "appnexus",
"params": {
"placementId": 6381313,
"referrer": "rlfans.co.uk",
"alt_referrer": "rlfans.co.uk"
}
},
{
"bidder": "appnexus",
"params": {
"placementId": 6381314,
"referrer": "rlfans.co.uk",
"alt_referrer": "rlfans.co.uk"
}
},
]
}
];
pbjs.addAdUnits(adUnits);
pbjs.requestBids();
});
</script>
</body>
</html>