diff --git a/modules/gridBidAdapter.js b/modules/gridBidAdapter.js index f2a340c7850..33c4bea23a4 100644 --- a/modules/gridBidAdapter.js +++ b/modules/gridBidAdapter.js @@ -104,6 +104,9 @@ export const spec = { (typeof bidderRequest.gdprConsent.gdprApplies === 'boolean') ? Number(bidderRequest.gdprConsent.gdprApplies) : 1; } + if (bidderRequest.uspConsent) { + payload.us_privacy = bidderRequest.uspConsent; + } } return { @@ -140,7 +143,7 @@ export const spec = { if (errorMessage) utils.logError(errorMessage); return bidResponses; }, - getUserSyncs: function (syncOptions, responses, gdprConsent) { + getUserSyncs: function (syncOptions, responses, gdprConsent, uspConsent) { if (!hasSynced && syncOptions.pixelEnabled) { let params = ''; @@ -151,6 +154,9 @@ export const spec = { params += `&gdpr_consent=${gdprConsent.consentString}`; } } + if (uspConsent) { + params += `&us_privacy=${uspConsent}`; + } hasSynced = true; return { diff --git a/test/spec/modules/gridBidAdapter_spec.js b/test/spec/modules/gridBidAdapter_spec.js index e1411da6e5a..a71f2c05657 100644 --- a/test/spec/modules/gridBidAdapter_spec.js +++ b/test/spec/modules/gridBidAdapter_spec.js @@ -131,6 +131,14 @@ describe('TheMediaGrid Adapter', function () { expect(payload).to.have.property('gdpr_consent', 'AAA'); expect(payload).to.have.property('gdpr_applies', '1'); }); + + it('if usPrivacy is present payload must have us_privacy param', function () { + const bidderRequestWithUSP = Object.assign({uspConsent: '1YNN'}, bidderRequest); + const request = spec.buildRequests(bidRequests, bidderRequestWithUSP); + expect(request.data).to.be.an('string'); + const payload = parseRequest(request.data); + expect(payload).to.have.property('us_privacy', '1YNN'); + }); }); describe('interpretResponse', function () { @@ -663,5 +671,11 @@ describe('TheMediaGrid Adapter', function () { type: 'image', url: syncUrl }); }); + + it('should pass usPrivacy param if it is available', function() { + expect(spec.getUserSyncs({ pixelEnabled: true }, {}, {}, '1YNN')).to.deep.equal({ + type: 'image', url: `${syncUrl}&us_privacy=1YNN` + }); + }); }); });