Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gumgum Bid Adapter: support coppa config #9192

Merged
merged 3 commits into from
Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fwiw the line above this is the wrong way to get timeout; the timeout from requestBids can be overridden in https://docs.prebid.org/dev-docs/publisher-api-reference/requestBids.html

For example, I think CafeMedia always overrides.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@patmmccann thanks for the review and for catching this issue. I'll make a ticket to review if we're using it or not and make the necessary corrections based on those findings.

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