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

Improve Digital adapter: add COPPA support #7948

Merged
merged 2 commits into from
Jan 21, 2022
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
5 changes: 5 additions & 0 deletions modules/improvedigitalBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export const spec = {
// End of adding first party data

requestParameters.schain = bidRequests[0].schain;
requestParameters.coppa = config.getConfig('coppa') === true;

if (bidRequests[0].userId) {
const eids = createEidsArray(bidRequests[0].userId);
Expand Down Expand Up @@ -652,6 +653,10 @@ export function ImproveDigitalAdServerJSClient(endPoint) {
}
}

if (requestParameters.coppa) {
impressionBidRequestObject.coppa = 1;
}

return impressionBidRequestObject;
};

Expand Down
19 changes: 19 additions & 0 deletions test/spec/modules/improvedigitalBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,25 @@ describe('Improve Digital Adapter Tests', function () {
]
);
});

it('should set coppa', function() {
sinon.stub(config, 'getConfig')
.withArgs('coppa')
.returns(true);
const bidRequest = Object.assign({}, simpleBidRequest);
const request = spec.buildRequests([bidRequest], bidderRequestReferrer)[0];
const params = JSON.parse(decodeURIComponent(request.data.substring(PARAM_PREFIX.length)));
expect(params.bid_request.coppa).to.equal(1);

config.getConfig.restore();
});

it('should undefined coppa', function() {
const bidRequest = Object.assign({}, simpleBidRequest);
const request = spec.buildRequests([bidRequest], bidderRequestReferrer)[0];
const params = JSON.parse(decodeURIComponent(request.data.substring(PARAM_PREFIX.length)));
expect(params.bid_request.coppa).to.equal(undefined);
});
});

const serverResponse = {
Expand Down