Skip to content

support gdpr for one video adapter #2981

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

Merged
merged 2 commits into from
Aug 23, 2018
Merged
Changes from 1 commit
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
30 changes: 27 additions & 3 deletions modules/oneVideoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,17 @@ export const spec = {
* Make a server request from the list of BidRequests.
*
* @param {validBidRequests[]} - an array of bids
* @param bidderRequest
* @return ServerRequest Info describing the request to the server.
*/
buildRequests: function(bids) {
buildRequests: function(bids, bidRequest) {
let consentData = bidRequest ? bidRequest.gdprConsent : null;

return bids.map(bid => {
return {
method: 'POST',
url: location.protocol + spec.ENDPOINT + bid.params.pubId,
data: getRequestData(bid),
data: getRequestData(bid, consentData),
options: {contentType: 'application/json'},
bidRequest: bid
}
Expand Down Expand Up @@ -127,7 +130,11 @@ function getSize(sizes) {
};
}

function getRequestData(bid) {
function isConsentRequired(consentData) {
return !!(consentData && consentData.gdprApplies);
}

function getRequestData(bid, consentData) {
let loc = utils.getTopWindowLocation();
let global = (window.top) ? window.top : window;
let page = (bid.params.site && bid.params.site.page) ? (bid.params.site.page) : (loc.href);
Expand Down Expand Up @@ -179,6 +186,23 @@ function getRequestData(bid) {
if (bid.params.site && bid.params.site.id) {
bidData.site.id = bid.params.site.id
}

if (isConsentRequired(consentData)) {
bidData.regs = {
ext: {
gdpr: NUMERIC_VALUES.TRUE
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you clarify what NUMERIC_VALUES is meant to be? I've seen other adapters pass a 1 or 0 for the boolean value of the gdprApplies in this field. Is that what you want to do as well?

Currently this is going to return an undefined error, since I don't see it declared/imported from anywhere. Can you update this part?

}
};

if (consentData.consentString) {
bidData.user = {
ext: {
consent: consentData.consentString
}
};
}
}

return bidData;
}

Expand Down