Skip to content

Commit

Permalink
GjirafaBidAdapter - Added GDPR support (prebid#2581)
Browse files Browse the repository at this point in the history
* Added GDPR support

* Fix test

* Fixed GDPR tests

* Fix test

* Fix tests
  • Loading branch information
agon-qurdina authored and dluxemburg committed Jul 17, 2018
1 parent 26cfe71 commit 8b36a7c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
4 changes: 4 additions & 0 deletions modules/gjirafaBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ export const spec = {
if (document.referrer) {
body.referrer = document.referrer;
}
if (bidderRequest && bidderRequest.gdprConsent) {
body.consent_string = bidderRequest.gdprConsent.consentString;
body.consent_required = (typeof bidderRequest.gdprConsent.gdprApplies === 'boolean') ? bidderRequest.gdprConsent.gdprApplies : true;
}
return {
method: 'GET',
url: ENDPOINT_URL,
Expand Down
16 changes: 14 additions & 2 deletions test/spec/modules/gjirafaBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ describe('gjirafaAdapterTest', () => {
'sizes': [[728, 90], [980, 200], [980, 150], [970, 90], [970, 250]],
'bidId': '10bdc36fe0b48c8',
'bidderRequestId': '70deaff71c281d',
'auctionId': 'f9012acc-b6b7-4748-9098-97252914f9dc'
'auctionId': 'f9012acc-b6b7-4748-9098-97252914f9dc',
'consent_string': 'consentString',
'consent_required': 'true'
},
{
'bidder': 'gjirafa',
Expand All @@ -67,7 +69,9 @@ describe('gjirafaAdapterTest', () => {
'sizes': [[300, 250]],
'bidId': '81a6dcb65e2bd9',
'bidderRequestId': '70deaff71c281d',
'auctionId': 'f9012acc-b6b7-4748-9098-97252914f9dc'
'auctionId': 'f9012acc-b6b7-4748-9098-97252914f9dc',
'consent_string': 'consentString',
'consent_required': 'true'
}];

it('bidRequest HTTP method', () => {
Expand Down Expand Up @@ -97,6 +101,14 @@ describe('gjirafaAdapterTest', () => {
expect(requests[0].data.sizes).to.equal('728x90;980x200;980x150;970x90;970x250');
expect(requests[1].data.sizes).to.equal('300x250');
});

it('should add GDPR data', () => {
const requests = spec.buildRequests(bidRequests);
expect(requests[0].data.consent_string).to.exists;
expect(requests[0].data.consent_required).to.exists;
expect(requests[1].data.consent_string).to.exists;
expect(requests[1].data.consent_required).to.exists;
});
});

describe('interpretResponse', () => {
Expand Down

0 comments on commit 8b36a7c

Please sign in to comment.