Skip to content

Commit

Permalink
Standardized COPPA support (prebid#3936)
Browse files Browse the repository at this point in the history
* Add microadBidAdapter

* Remove unnecessary encodeURIComponent from microadBidAdapter

* Submit Advangelists Prebid Adapter

* Submit Advangelists Prebid Adapter 1.1

* Correct procudtion endpoint for prebid

* Send coppa flag on requests to OpenRTB from Prebid server

* Support coppa flag being set in Prebid config

* Add unit tests for deepSetValue util function
  • Loading branch information
msm0504 authored and Alex committed Aug 1, 2019
1 parent 2055b7a commit b17f183
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 3 deletions.
2 changes: 1 addition & 1 deletion modules/arteebeeBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function makeRtbRequest(req, bidderRequest) {
'tmax': config.getConfig('bidderTimeout')
};

if (req.params.coppa) {
if (config.getConfig('coppa') === true || req.params.coppa) {
rtbReq.regs = {coppa: 1};
}

Expand Down
2 changes: 1 addition & 1 deletion modules/openxBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ function buildOXBannerRequest(bids, bidderRequest) {
queryParams.ns = 1;
}

if (bids.some(bid => bid.params.coppa)) {
if (config.getConfig('coppa') === true || bids.some(bid => bid.params.coppa)) {
queryParams.tfcd = 1;
}

Expand Down
2 changes: 1 addition & 1 deletion modules/openxoutstreamBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ function buildOXBannerRequest(bid, bidderRequest) {
queryParams.ns = 1;
}

if (bid.params.coppa) {
if (config.getConfig('coppa') === true || bid.params.coppa) {
queryParams.tfcd = 1;
}

Expand Down
4 changes: 4 additions & 0 deletions modules/prebidServerBidAdapter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,10 @@ const OPEN_RTB_PROTOCOL = {
utils.deepSetValue(request, 'user.ext.consent', bidRequests[0].gdprConsent.consentString);
}

if (getConfig('coppa') === true) {
utils.deepSetValue(request, 'regs.coppa', 1);
}

return request;
},

Expand Down
8 changes: 8 additions & 0 deletions modules/rubiconBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,10 @@ export const spec = {
}
}

if (config.getConfig('coppa') === true) {
utils.deepSetValue(request, 'regs.coppa', 1);
}

return {
method: 'POST',
url: VIDEO_ENDPOINT,
Expand Down Expand Up @@ -434,6 +438,10 @@ export const spec = {
const digitrustParams = _getDigiTrustQueryParams(bidRequest, 'FASTLANE');
Object.assign(data, digitrustParams);

if (config.getConfig('coppa') === true) {
data['coppa'] = 1;
}

return data;
},

Expand Down
23 changes: 23 additions & 0 deletions test/spec/utils_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,29 @@ describe('Utils', function () {
});
});

describe('deepSetValue', function() {
it('should set existing properties at various depths', function() {
const testObj = {
prop: 'value',
nestedObj: {
nestedProp: 'nestedValue'
}
};
utils.deepSetValue(testObj, 'prop', 'newValue');
assert.equal(testObj.prop, 'newValue');
utils.deepSetValue(testObj, 'nestedObj.nestedProp', 'newNestedValue');
assert.equal(testObj.nestedObj.nestedProp, 'newNestedValue');
});

it('should create object levels between top and bottom of given path if they do not exist', function() {
const testObj = {};
utils.deepSetValue(testObj, 'level1.level2', 'value');
assert.notEqual(testObj.level1, undefined);
assert.notEqual(testObj.level1.level2, undefined);
assert.equal(testObj.level1.level2, 'value');
});
});

describe('createContentToExecuteExtScriptInFriendlyFrame', function () {
it('should return empty string if url is not passed', function () {
var output = utils.createContentToExecuteExtScriptInFriendlyFrame();
Expand Down

0 comments on commit b17f183

Please sign in to comment.