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

TripleLift COPPA support #4850

Merged
merged 2 commits into from
Feb 19, 2020
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/tripleliftBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { BANNER } from '../src/mediaTypes';
import { registerBidder } from '../src/adapters/bidderFactory';
import * as utils from '../src/utils';
import { config } from '../src/config';

const BIDDER_CODE = 'triplelift';
const STR_ENDPOINT = 'https://tlx.3lift.com/header/auction?';
Expand Down Expand Up @@ -46,6 +47,10 @@ export const tripleliftAdapterSpec = {
tlCall = utils.tryAppendQueryString(tlCall, 'us_privacy', bidderRequest.uspConsent);
}

if (config.getConfig('coppa') === true) {
tlCall = utils.tryAppendQueryString(tlCall, 'coppa', true);
}

if (tlCall.lastIndexOf('&') === tlCall.length - 1) {
tlCall = tlCall.substring(0, tlCall.length - 1);
}
Expand Down
15 changes: 15 additions & 0 deletions test/spec/modules/tripleliftBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { expect } from 'chai';
import { tripleliftAdapterSpec } from 'modules/tripleliftBidAdapter';
import { newBidder } from 'src/adapters/bidderFactory';
import { deepClone } from 'src/utils';
import { config } from 'src/config';
import prebid from '../../../package.json';

const ENDPOINT = 'https://tlx.3lift.com/header/auction?';
Expand Down Expand Up @@ -273,6 +274,20 @@ describe('triplelift adapter', function () {
const url = request.url;
expect(url).to.match(/(\?|&)us_privacy=1YYY/);
});
it('should return coppa param when COPPA config is set to true', function() {
sinon.stub(config, 'getConfig').withArgs('coppa').returns(true);
const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest);
config.getConfig.restore();
const url = request.url;
expect(url).to.match(/(\?|&)coppa=true/);
});
it('should not return coppa param when COPPA config is set to false', function() {
sinon.stub(config, 'getConfig').withArgs('coppa').returns(false);
const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest);
config.getConfig.restore();
const url = request.url;
expect(url).not.to.match(/(\?|&)coppa=/);
});
it('should return schain when present', function() {
const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest);
const { data: payload } = request;
Expand Down