Skip to content

Commit

Permalink
Sharethrough Bid Adapter: add support for COPPA (#6602)
Browse files Browse the repository at this point in the history
* Pass COPPA flag to Ad Server

[#177598971]

* Send true instead of 1

* Upgrade adapter version number
  • Loading branch information
Mathieu Pheulpin authored Apr 16, 2021
1 parent 1b28481 commit dd64734
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
7 changes: 6 additions & 1 deletion modules/sharethroughBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { registerBidder } from '../src/adapters/bidderFactory.js';
import * as utils from '../src/utils.js';
import { config } from '../src/config.js';

const VERSION = '3.3.1';
const VERSION = '3.3.2';
const BIDDER_CODE = 'sharethrough';
const STR_ENDPOINT = 'https://btlr.sharethrough.com/WYu2BXv1/v1';
const DEFAULT_SIZE = [1, 1];
Expand Down Expand Up @@ -48,6 +49,10 @@ export const sharethroughAdapterSpec = {
query.us_privacy = bidderRequest.uspConsent
}

if (config.getConfig('coppa') === true) {
query.coppa = true
}

if (bidRequest.schain) {
query.schain = JSON.stringify(bidRequest.schain);
}
Expand Down
24 changes: 24 additions & 0 deletions test/spec/modules/sharethroughBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { expect } from 'chai';
import { sharethroughAdapterSpec, sharethroughInternal } from 'modules/sharethroughBidAdapter.js';
import { newBidder } from 'src/adapters/bidderFactory.js';
import * as utils from '../../../src/utils.js';
import { config } from 'src/config';

const spec = newBidder(sharethroughAdapterSpec).getSpec();
const bidRequests = [
Expand Down Expand Up @@ -441,6 +442,29 @@ describe('sharethrough adapter spec', function() {
const builtBidRequest = spec.buildRequests([bidRequest])[0];
expect(builtBidRequest.data).to.not.include.any.keys('bidfloor');
});

describe('coppa', function() {
it('should add coppa to request if enabled', function() {
config.setConfig({coppa: true});
const bidRequest = Object.assign({}, bidRequests[0]);
const builtBidRequest = spec.buildRequests([bidRequest])[0];
expect(builtBidRequest.data.coppa).to.eq(true);
});

it('should not add coppa to request if disabled', function() {
config.setConfig({coppa: false});
const bidRequest = Object.assign({}, bidRequests[0]);
const builtBidRequest = spec.buildRequests([bidRequest])[0];
expect(builtBidRequest.data.coppa).to.be.undefined;
});

it('should not add coppa to request if unknown value', function() {
config.setConfig({coppa: 'something'});
const bidRequest = Object.assign({}, bidRequests[0]);
const builtBidRequest = spec.buildRequests([bidRequest])[0];
expect(builtBidRequest.data.coppa).to.be.undefined;
});
});
});

describe('.interpretResponse', function() {
Expand Down

0 comments on commit dd64734

Please sign in to comment.