Skip to content

Commit

Permalink
Merge pull request #6 from gumgum/ADJS-1227-add-coppa-flag-to-gumgum-…
Browse files Browse the repository at this point in the history
…adapter

ADJS-1227-add-coppa-flag-to-gumgum-adapter
  • Loading branch information
john-ivan committed Nov 2, 2022
2 parents b762241 + 151ad47 commit 8304a1a
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 8304a1a

Please sign in to comment.