diff --git a/modules/gumgumBidAdapter.js b/modules/gumgumBidAdapter.js index 2325e1bc448..4068e5ac5a4 100644 --- a/modules/gumgumBidAdapter.js +++ b/modules/gumgumBidAdapter.js @@ -158,6 +158,7 @@ function isBidRequestValid (bid) { function buildRequests (validBidRequests, bidderRequest) { const bids = []; const gdprConsent = bidderRequest && bidderRequest.gdprConsent; + const uspConsent = bidderRequest && bidderRequest.uspConsent; utils._each(validBidRequests, bidRequest => { const timeout = config.getConfig('bidderTimeout'); const { @@ -198,6 +199,9 @@ function buildRequests (validBidRequests, bidderRequest) { if (data.gdprApplies) { data.gdprConsent = gdprConsent.consentString; } + if (uspConsent) { + data.uspConsent = uspConsent; + } if (schain && schain.nodes) { data.schain = _serializeSupplyChainObj(schain); } diff --git a/test/spec/modules/gumgumBidAdapter_spec.js b/test/spec/modules/gumgumBidAdapter_spec.js index cbd71cc82f0..4789a8f0523 100644 --- a/test/spec/modules/gumgumBidAdapter_spec.js +++ b/test/spec/modules/gumgumBidAdapter_spec.js @@ -146,7 +146,7 @@ describe('gumgumAdapter', function () { expect(request.data).to.not.include.any.keys('eAdBuyId'); expect(request.data).to.not.include.any.keys('adBuyId'); }); - it('should add consent parameters if gdprConsent is present', function () { + it('should add gdpr consent parameters if gdprConsent is present', function () { const gdprConsent = { consentString: 'BOJ/P2HOJ/P2HABABMAAAAAZ+A==', gdprApplies: true }; const fakeBidRequest = { gdprConsent: gdprConsent }; const bidRequest = spec.buildRequests(bidRequests, fakeBidRequest)[0]; @@ -159,6 +159,14 @@ describe('gumgumAdapter', function () { const bidRequest = spec.buildRequests(bidRequests, fakeBidRequest)[0]; expect(bidRequest.data).to.not.include.any.keys('gdprConsent') }); + it('should add uspConsent parameter if it is present in the bidderRequest', function () { + const noUspBidRequest = spec.buildRequests(bidRequests)[0]; + const uspConsentObj = { uspConsent: '1YYY' }; + const bidRequest = spec.buildRequests(bidRequests, uspConsentObj)[0]; + expect(noUspBidRequest.data).to.not.include.any.keys('uspConsent'); + expect(bidRequest.data).to.include.any.keys('uspConsent'); + expect(bidRequest.data.uspConsent).to.eq(uspConsentObj.uspConsent); + }); it('should add a tdid parameter if request contains unified id from TradeDesk', function () { const unifiedId = { 'userId': {