Skip to content

Commit

Permalink
gumgum Bid Adapter: support coppa config (prebid#9192)
Browse files Browse the repository at this point in the history
* ADJS-1227-add-coppa-flag-to-gumgum-adapter

* added tests for coppa config for gumgumBidAdapter

Co-authored-by: John Bauzon <john.bauzon@gumgum.com>
  • Loading branch information
2 people authored and JacobKlein26 committed Feb 8, 2023
1 parent efcc26c commit e00cd8b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modules/gumgumBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ function buildRequests(validBidRequests, bidderRequest) {
const gdprConsent = bidderRequest && bidderRequest.gdprConsent;
const uspConsent = bidderRequest && bidderRequest.uspConsent;
const timeout = config.getConfig('bidderTimeout');
const coppa = config.getConfig('coppa') === true ? 1 : 0;
const topWindowUrl = bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.page;
_each(validBidRequests, bidRequest => {
const {
Expand Down Expand Up @@ -386,6 +387,9 @@ function buildRequests(validBidRequests, bidderRequest) {
if (uspConsent) {
data.uspConsent = uspConsent;
}
if (coppa) {
data.coppa = coppa;
}
if (schain && schain.nodes) {
data.schain = _serializeSupplyChainObj(schain);
}
Expand Down
15 changes: 15 additions & 0 deletions test/spec/modules/gumgumBidAdapter_spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { BANNER, VIDEO } from 'src/mediaTypes.js';

import { config } from 'src/config.js';
import { expect } from 'chai';
import { newBidder } from 'src/adapters/bidderFactory.js';
import { spec } from 'modules/gumgumBidAdapter.js';
Expand Down Expand Up @@ -484,6 +485,20 @@ describe('gumgumAdapter', function () {
const bidRequest = spec.buildRequests(bidRequests, fakeBidRequest)[0];
expect(bidRequest.data).to.not.include.any.keys('gdprConsent')
});
it('should not set coppa parameter if coppa config is set to false', function () {
config.setConfig({
coppa: false
});
const bidRequest = spec.buildRequests(bidRequests)[0];
expect(bidRequest.data.coppa).to.eq(undefined);
});
it('should set coppa parameter to 1 if coppa config is set to true', function () {
config.setConfig({
coppa: true
});
const bidRequest = spec.buildRequests(bidRequests)[0];
expect(bidRequest.data.coppa).to.eq(1);
});
it('should add uspConsent parameter if it is present in the bidderRequest', function () {
const noUspBidRequest = spec.buildRequests(bidRequests)[0];
const uspConsentObj = { uspConsent: '1YYY' };
Expand Down

0 comments on commit e00cd8b

Please sign in to comment.