Prebid.js icon indicating copy to clipboard operation
Prebid.js copied to clipboard

error in sample code at http://prebid.org/dev-docs/modules/consentManagement.html

Open tsanders42 opened this issue 8 years ago • 5 comments

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);
        }
    };

tsanders42 avatar Jun 20 '18 11:06 tsanders42

Correct, my mistake (doh!). Can you put a PR please?

YOzaz avatar Jun 20 '18 11:06 YOzaz

Fixed here: https://github.com/prebid/prebid.github.io/commit/b413f5f22ad1557782e2689030bccfbbf6bf6468

YOzaz avatar Jun 22 '18 12:06 YOzaz

closing. please re-open if necessary.

harpere avatar Jun 22 '18 20:06 harpere

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 avatar Sep 06 '18 08:09 allanjun

@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 👍

YOzaz avatar Sep 06 '18 18:09 YOzaz