Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GDPR support for Quantcast adapter #2733

Merged
merged 2 commits into from
Jun 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions modules/quantcastBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ export const spec = {
* `BidRequests`.
*
* @param {BidRequest[]} bidRequests A non-empty list of bid requests which should be send to Quantcast server
* @param bidderRequest
* @return ServerRequest information describing the request to the server.
*/
buildRequests(bidRequests) {
buildRequests(bidRequests, bidderRequest) {
const bids = bidRequests || [];

const referrer = utils.getTopWindowUrl();
Expand Down Expand Up @@ -75,6 +76,8 @@ export const spec = {
});
});

const gdprConsent = bidderRequest ? bidderRequest.gdprConsent : {};

// Request Data Format can be found at https://wiki.corp.qc/display/adinf/QCX
const requestData = {
publisherId: bid.params.publisherId,
Expand All @@ -94,7 +97,9 @@ export const spec = {
referrer,
domain
},
bidId: bid.bidId
bidId: bid.bidId,
gdprSignal: gdprConsent.gdprApplies ? 1 : 0,
gdprConsent: gdprConsent.consentString
};

const data = JSON.stringify(requestData);
Expand Down
4 changes: 2 additions & 2 deletions modules/quantcastBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
```
Module Name: Quantcast Bidder Adapter
Module Type: Bidder Adapter
Maintainer: xli@quantcast.com
Maintainer: igor.soarez@quantcast.com
```

# Description
Expand All @@ -28,4 +28,4 @@ const adUnits = [{
}
]
}];
```
```
11 changes: 10 additions & 1 deletion test/spec/modules/quantcastBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,22 @@ describe('Quantcast adapter', () => {
referrer,
domain
},
bidId: '2f7b179d443f14'
bidId: '2f7b179d443f14',
gdprSignal: 0
};

expect(requests[0].data).to.equal(JSON.stringify(expectedBidRequest));
});
});

it('propagates GDPR consent string and signal', () => {
const gdprConsent = { gdprApplies: true, consentString: 'consentString' }
const requests = qcSpec.buildRequests([bidRequest], { gdprConsent });
const parsed = JSON.parse(requests[0].data)
expect(parsed.gdprSignal).to.equal(1);
expect(parsed.gdprConsent).to.equal(gdprConsent.consentString);
});

describe('`interpretResponse`', () => {
// The sample response is from https://wiki.corp.qc/display/adinf/QCX
const body = {
Expand Down