diff --git a/modules/gumgumBidAdapter.js b/modules/gumgumBidAdapter.js index 93306984ab1..b12aa3ee861 100644 --- a/modules/gumgumBidAdapter.js +++ b/modules/gumgumBidAdapter.js @@ -293,6 +293,7 @@ function buildRequests(validBidRequests, bidderRequest) { const bids = []; const gdprConsent = bidderRequest && bidderRequest.gdprConsent; const uspConsent = bidderRequest && bidderRequest.uspConsent; + const gppConsent = bidderRequest && bidderRequest.gppConsent; const timeout = config.getConfig('bidderTimeout'); const coppa = config.getConfig('coppa') === true ? 1 : 0; const topWindowUrl = bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.page; @@ -387,6 +388,17 @@ function buildRequests(validBidRequests, bidderRequest) { if (uspConsent) { data.uspConsent = uspConsent; } + if (gppConsent) { + data.gppConsent = { + gppString: bidderRequest.gppConsent.gppString, + applicableSections: bidderRequest.gppConsent.applicableSections + } + } else if (!gppConsent && bidderRequest?.ortb2?.regs?.gpp) { + data.gppConsent = { + gppString: bidderRequest.ortb2.regs.gpp, + applicableSections: bidderRequest.ortb2.regs.gpp_sid + }; + } if (coppa) { data.coppa = coppa; } diff --git a/test/spec/modules/gumgumBidAdapter_spec.js b/test/spec/modules/gumgumBidAdapter_spec.js index a2dacb16b73..80ca85801b6 100644 --- a/test/spec/modules/gumgumBidAdapter_spec.js +++ b/test/spec/modules/gumgumBidAdapter_spec.js @@ -485,6 +485,46 @@ describe('gumgumAdapter', function () { const bidRequest = spec.buildRequests(bidRequests, fakeBidRequest)[0]; expect(bidRequest.data).to.not.include.any.keys('gdprConsent') }); + it('should add gpp parameters if gppConsent is present', function () { + const gppConsent = { gppString: 'DBACNYA~CPXxRfAPXxRfAAfKABENB-CgAAAAAAAAAAYgAAAAAAAA~1YNN', applicableSections: [7] } + const fakeBidRequest = { gppConsent: gppConsent }; + const bidRequest = spec.buildRequests(bidRequests, fakeBidRequest)[0]; + expect(bidRequest.data.gppConsent).to.exist; + expect(bidRequest.data.gppConsent.gppString).to.equal(gppConsent.gppString); + expect(bidRequest.data.gppConsent.applicableSections).to.equal(gppConsent.applicableSections); + expect(bidRequest.data.gppConsent.gppString).to.eq('DBACNYA~CPXxRfAPXxRfAAfKABENB-CgAAAAAAAAAAYgAAAAAAAA~1YNN'); + }); + it('should handle ortb2 parameters', function () { + const ortb2 = { + regs: { + gpp: 'DBACNYA~CPXxRfAPXxRfAAfKABENB-CgAAAAAAAAAAYgAAAAAAAA~1YNN', + gpp_sid: [7] + } + } + const fakeBidRequest = { gppConsent: ortb2 }; + const bidRequest = spec.buildRequests(bidRequests, fakeBidRequest)[0]; + expect(bidRequest.data.gppConsent.gppString).to.eq(fakeBidRequest[0]) + }); + it('should handle gppConsent is present but values are undefined case', function () { + const gppConsent = { gppString: undefined, applicableSections: undefined } + const fakeBidRequest = { gppConsent: gppConsent }; + const bidRequest = spec.buildRequests(bidRequests, fakeBidRequest)[0]; + expect(bidRequest.data.gppConsent).to.exist; + expect(bidRequest.data.gppConsent.gppString).to.equal(undefined); + expect(bidRequest.data.gppConsent.applicableSections).to.equal(undefined); + }); + it('should handle ortb2 undefined parameters', function () { + const ortb2 = { + regs: { + gpp: undefined, + gpp_sid: undefined + } + } + const fakeBidRequest = { gppConsent: ortb2 }; + const bidRequest = spec.buildRequests(bidRequests, fakeBidRequest)[0]; + expect(bidRequest.data.gppConsent.gppString).to.eq(undefined) + expect(bidRequest.data.gppConsent.applicableSections).to.eq(undefined) + }); it('should not set coppa parameter if coppa config is set to false', function () { config.setConfig({ coppa: false