Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update consentManagementUsp.js to not store and reuse null consent #5452

Merged
merged 8 commits into from
Jul 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions modules/consentManagementUsp.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,6 @@ export function requestBidsHook(fn, reqBidsConfigObj) {
timer: null
};

// in case we already have consent (eg during bid refresh)
if (consentData) {
return exitModule(null, hookConfig);
}

if (!uspCallMap[consentAPI]) {
utils.logWarn(`USP framework (${consentAPI}) is not a supported framework. Aborting consentManagement module and resuming auction.`);
return hookConfig.nextFn.apply(hookConfig.context, hookConfig.args);
Expand Down
7 changes: 5 additions & 2 deletions test/spec/modules/consentManagementUsp_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,10 @@ describe('consentManagement', function () {
resetConsentData();
});

it('should bypass CMP and simply use previously stored consentData', function () {
// from prebid 4425 - "the USP (CCPA) api function __uspapi() always responds synchronously, whether or not privacy data is available, while the GDPR CMP may respond asynchronously
// Because the USP API does not wait for a user response, if it was not successfully obtained before the first auction, we should try again to retrieve privacy data before each subsequent auction.

it('should not bypass CMP and simply use previously stored consentData', function () {
let testConsentData = {
uspString: '1YY'
};
Expand All @@ -208,7 +211,7 @@ describe('consentManagement', function () {
let consent = uspDataHandler.getConsentData();
expect(didHookReturn).to.be.true;
expect(consent).to.equal(testConsentData.uspString);
sinon.assert.notCalled(uspStub);
sinon.assert.called(uspStub);
});
});

Expand Down