Skip to content

Commit

Permalink
Added US Privacy support for TheMediaGrid Bid Adapter (prebid#4606)
Browse files Browse the repository at this point in the history
* Added Grid Bid Adapter

* remove priceType from TheMediaGrid Bid Adapter

* Add video support in Grid Bid Adapter

* Added test parameter for video slot

* update Grid Bid Adapter to set size in response bid

* Update Grid Bid Adapter to support identical uids in parameters

* Fix typo in test file for Grid Bid Adapter

* Update The Grid Media Bidder Adapter to send refererInfo.referer as 'u' parameter in ad request

* Hotfix for referrer in Grid Bid Adapter

* Grid Bid Adapter: added wrapperType and wrappweVersion to the ad request

* TheMediaGrid Bid Adapter: added sync url

* TheMediaGrid Bid Adapter: added GDPR params to sync url

* TheMediaGrid Bid Adapter: added tests for getUserSyncs function

* Added CCPA support in TheMediaGrid Bid Adapter
  • Loading branch information
TheMediaGrid authored and tadam75 committed Jan 9, 2020
1 parent 02d8026 commit 9ebb5b0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
8 changes: 7 additions & 1 deletion modules/gridBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 = '';

Expand All @@ -151,6 +154,9 @@ export const spec = {
params += `&gdpr_consent=${gdprConsent.consentString}`;
}
}
if (uspConsent) {
params += `&us_privacy=${uspConsent}`;
}

hasSynced = true;
return {
Expand Down
14 changes: 14 additions & 0 deletions test/spec/modules/gridBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down Expand Up @@ -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`
});
});
});
});

0 comments on commit 9ebb5b0

Please sign in to comment.