diff --git a/modules/sonobiBidAdapter.js b/modules/sonobiBidAdapter.js index 0e4bfb37829..e5bd76eba9f 100644 --- a/modules/sonobiBidAdapter.js +++ b/modules/sonobiBidAdapter.js @@ -140,6 +140,12 @@ export const spec = { payload.us_privacy = bidderRequest.uspConsent; } + if (config.getConfig('coppa') === true) { + payload.coppa = 1; + } else { + payload.coppa = 0; + } + // If there is no key_maker data, then don't make the request. if (isEmpty(data)) { return null; diff --git a/test/spec/modules/sonobiBidAdapter_spec.js b/test/spec/modules/sonobiBidAdapter_spec.js index d1ac200394c..0314ffb71c1 100644 --- a/test/spec/modules/sonobiBidAdapter_spec.js +++ b/test/spec/modules/sonobiBidAdapter_spec.js @@ -2,10 +2,10 @@ import { expect } from 'chai' import { spec, _getPlatform } from 'modules/sonobiBidAdapter.js' import { newBidder } from 'src/adapters/bidderFactory.js' import {userSync} from '../../../src/userSync.js'; +import { config } from 'src/config.js'; describe('SonobiBidAdapter', function () { const adapter = newBidder(spec) - describe('.code', function () { it('should return a bidder code of sonobi', function () { expect(spec.code).to.equal('sonobi') @@ -304,6 +304,20 @@ describe('SonobiBidAdapter', function () { uspConsent: 'someCCPAString' }; + it('should populate coppa as 1 if set in config', function () { + config.setConfig({coppa: true}); + const bidRequests = spec.buildRequests(bidRequest, bidderRequests); + + expect(bidRequests.data.coppa).to.equal(1); + }); + + it('should populate coppa as 0 if set in config', function () { + config.setConfig({coppa: false}); + const bidRequests = spec.buildRequests(bidRequest, bidderRequests); + + expect(bidRequests.data.coppa).to.equal(0); + }); + it('should return a properly formatted request', function () { const bidRequests = spec.buildRequests(bidRequest, bidderRequests) const bidRequestsPageViewID = spec.buildRequests(bidRequest, bidderRequests)