Skip to content

Commit

Permalink
Consent management module: allow auction to continue when CMP does no…
Browse files Browse the repository at this point in the history
…t respond (prebid#7769)

This reproduces the behavior of `allowAuctionWithoutConsent` when a TCFv2 CMP times out.
prebid#7156
  • Loading branch information
dgirardi authored and avj83 committed Jan 24, 2022
1 parent 9aef83d commit 074c4ff
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
8 changes: 7 additions & 1 deletion modules/consentManagement.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,13 @@ function processCmpData(consentObject, hookConfig) {
* General timeout callback when interacting with CMP takes too long.
*/
function cmpTimedOut(hookConfig) {
cmpFailed('CMP workflow exceeded timeout threshold.', hookConfig);
if (cmpVersion === 2) {
logWarn(`No response from CMP, continuing auction...`)
storeConsentData(undefined);
exitModule(null, hookConfig)
} else {
cmpFailed('CMP workflow exceeded timeout threshold.', hookConfig);
}
}

/**
Expand Down
20 changes: 20 additions & 0 deletions test/spec/modules/consentManagement_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,26 @@ describe('consentManagement', function () {
expect(consent).to.be.null;
});

it('allows the auction when CMP is unresponsive', (done) => {
setConsentConfig({
cmpApi: 'iab',
timeout: 10,
defaultGdprScope: true
});

requestBidsHook(() => {
didHookReturn = true;
}, {});

setTimeout(() => {
expect(didHookReturn).to.be.true;
const consent = gdprDataHandler.getConsentData();
expect(consent.gdprApplies).to.be.true;
expect(consent.consentString).to.be.undefined;
done();
}, 20);
});

it('It still considers it a valid cmp response if gdprApplies is not a boolean', function () {
// gdprApplies is undefined, should just still store consent response but use whatever defaultGdprScope was
let testConsentData = {
Expand Down

0 comments on commit 074c4ff

Please sign in to comment.