error in sample code at http://prebid.org/dev-docs/modules/consentManagement.html
in the sample code for implementing the stub functions for non-IAB compliant CMPs, I'm assuming that that 'function' should be replaced with 'var' current version:
function cmpFunc = function(command, version, callback) {
if (command === 'ping') {
callback({gdprAppliesGlobally: gdprApplies, cmpLoaded: cmpLoaded}, responseCode);
} else if (command === 'getConsentData') {
callback({consentData: iabConsentData, gdprApplies: gdprApplies, hasGlobalScope: hasGlobalScope}, responseCode);
} else if (command === 'getVendorConsents') {
callback({metadata: iabConsentData, gdprApplies: gdprApplies, hasGlobalScope: hasGlobalScope}, responseCode);
} else {
callback(undefined, false);
}
};
proposed change:
var cmpFunc = function(command, version, callback) {
if (command === 'ping') {
callback({gdprAppliesGlobally: gdprApplies, cmpLoaded: cmpLoaded}, responseCode);
} else if (command === 'getConsentData') {
callback({consentData: iabConsentData, gdprApplies: gdprApplies, hasGlobalScope: hasGlobalScope}, responseCode);
} else if (command === 'getVendorConsents') {
callback({metadata: iabConsentData, gdprApplies: gdprApplies, hasGlobalScope: hasGlobalScope}, responseCode);
} else {
callback(undefined, false);
}
};
Correct, my mistake (doh!). Can you put a PR please?
Fixed here: https://github.com/prebid/prebid.github.io/commit/b413f5f22ad1557782e2689030bccfbbf6bf6468
closing. please re-open if necessary.
hi @harpere @YOzaz
Per https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework/blob/master/CMP%20JS%20API%20v1.1%20Final.md#vendorconsents
the command getVendorConsents should also return purposeConsents and vendorConsents
this is needed if the calls this command passing its vendorId as parameter
@allanjun theoretically yes, but practically all consents are encoded into consent string itself. More than that, method should accept vendor IDs and return consents only for requested. In reality, this method call is used either by vendors themselves - which are fine with consent string only, either by CMP itself - which requires VendorConsents object to be populated in full, in order to display vendors/purposes selection (e.g.) for end user. I've tested this code with Prebid.js and other ad networks, and never saw full reponse required. In any case, that's only a boilerplate. Feel free to expand it 👍