Skip to content

Commit

Permalink
TripleLift COPPA support (#4850)
Browse files Browse the repository at this point in the history
* Add COPPA support

* Modify test
  • Loading branch information
davidwoodsandersen authored Feb 19, 2020
1 parent 3662ee3 commit 407dc92
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
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

0 comments on commit 407dc92

Please sign in to comment.