From 865cd585f4d08896961a0f813c7436515755b66d Mon Sep 17 00:00:00 2001 From: dpapworth-qc Date: Fri, 6 Dec 2019 13:45:14 +0000 Subject: [PATCH 1/2] Pass uspConsent parameter from bidder request to QC endpoint. --- modules/quantcastBidAdapter.js | 5 +++-- test/spec/modules/quantcastBidAdapter_spec.js | 15 +++++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/modules/quantcastBidAdapter.js b/modules/quantcastBidAdapter.js index 673a7f41c00..1c0f3dab376 100644 --- a/modules/quantcastBidAdapter.js +++ b/modules/quantcastBidAdapter.js @@ -101,8 +101,8 @@ export const spec = { */ buildRequests(bidRequests, bidderRequest) { const bids = bidRequests || []; - const gdprConsent = (bidderRequest && bidderRequest.gdprConsent) ? bidderRequest.gdprConsent : {}; - + const gdprConsent = utils.deepAccess(bidderRequest, 'gdprConsent') || {}; + const uspConsent = utils.deepAccess(bidderRequest, 'uspConsent'); const referrer = utils.deepAccess(bidderRequest, 'refererInfo.referer'); const page = utils.deepAccess(bidderRequest, 'refererInfo.canonicalUrl') || config.getConfig('pageUrl') || utils.deepAccess(window, 'location.href'); const domain = getDomain(page); @@ -139,6 +139,7 @@ export const spec = { bidId: bid.bidId, gdprSignal: gdprConsent.gdprApplies ? 1 : 0, gdprConsent: gdprConsent.consentString, + uspConsent, prebidJsVersion: '$prebid.version$' }; diff --git a/test/spec/modules/quantcastBidAdapter_spec.js b/test/spec/modules/quantcastBidAdapter_spec.js index b91536689db..041150061db 100644 --- a/test/spec/modules/quantcastBidAdapter_spec.js +++ b/test/spec/modules/quantcastBidAdapter_spec.js @@ -337,11 +337,18 @@ describe('Quantcast adapter', function () { }); it('propagates GDPR consent string and signal', function () { - const gdprConsent = { gdprApplies: true, consentString: 'consentString' } - const requests = qcSpec.buildRequests([bidRequest], { gdprConsent }); - const parsed = JSON.parse(requests[0].data) + const bidderRequest = { gdprConsent: { gdprApplies: true, consentString: 'consentString' } } + const requests = qcSpec.buildRequests([bidRequest], bidderRequest); + const parsed = JSON.parse(requests[0].data); expect(parsed.gdprSignal).to.equal(1); - expect(parsed.gdprConsent).to.equal(gdprConsent.consentString); + expect(parsed.gdprConsent).to.equal('consentString'); + }); + + it('propagates US Privacy/CCPA consent information', function () { + const bidderRequest = { uspConsent: 'consentString' } + const requests = qcSpec.buildRequests([bidRequest], bidderRequest); + const parsed = JSON.parse(requests[0].data); + expect(parsed.uspConsent).to.equal('consentString'); }); describe('`interpretResponse`', function () { From 9f5356aa68bde0937a4d98eeca4e1563109740c7 Mon Sep 17 00:00:00 2001 From: dpapworth-qc Date: Mon, 9 Dec 2019 10:16:45 +0000 Subject: [PATCH 2/2] Added uspSignal to indicate if uspConsent has been passed in request. --- modules/quantcastBidAdapter.js | 1 + test/spec/modules/quantcastBidAdapter_spec.js | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/modules/quantcastBidAdapter.js b/modules/quantcastBidAdapter.js index 1c0f3dab376..93f8e398a9d 100644 --- a/modules/quantcastBidAdapter.js +++ b/modules/quantcastBidAdapter.js @@ -139,6 +139,7 @@ export const spec = { bidId: bid.bidId, gdprSignal: gdprConsent.gdprApplies ? 1 : 0, gdprConsent: gdprConsent.consentString, + uspSignal: uspConsent ? 1 : 0, uspConsent, prebidJsVersion: '$prebid.version$' }; diff --git a/test/spec/modules/quantcastBidAdapter_spec.js b/test/spec/modules/quantcastBidAdapter_spec.js index 041150061db..7e7d47d3644 100644 --- a/test/spec/modules/quantcastBidAdapter_spec.js +++ b/test/spec/modules/quantcastBidAdapter_spec.js @@ -137,6 +137,7 @@ describe('Quantcast adapter', function () { }, bidId: '2f7b179d443f14', gdprSignal: 0, + uspSignal: 0, prebidJsVersion: '$prebid.version$' }; @@ -203,6 +204,7 @@ describe('Quantcast adapter', function () { }, bidId: '2f7b179d443f14', gdprSignal: 0, + uspSignal: 0, prebidJsVersion: '$prebid.version$' }; @@ -237,6 +239,7 @@ describe('Quantcast adapter', function () { }, bidId: '2f7b179d443f14', gdprSignal: 0, + uspSignal: 0, prebidJsVersion: '$prebid.version$' }; @@ -267,6 +270,7 @@ describe('Quantcast adapter', function () { }, bidId: '2f7b179d443f14', gdprSignal: 0, + uspSignal: 0, prebidJsVersion: '$prebid.version$' }; @@ -329,6 +333,7 @@ describe('Quantcast adapter', function () { }, bidId: '2f7b179d443f14', gdprSignal: 0, + uspSignal: 0, prebidJsVersion: '$prebid.version$' }; @@ -348,6 +353,7 @@ describe('Quantcast adapter', function () { const bidderRequest = { uspConsent: 'consentString' } const requests = qcSpec.buildRequests([bidRequest], bidderRequest); const parsed = JSON.parse(requests[0].data); + expect(parsed.uspSignal).to.equal(1); expect(parsed.uspConsent).to.equal('consentString'); });