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 : add GPP support in the bid request #9572

Merged
merged 1 commit into from
Feb 22, 2023
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
12 changes: 12 additions & 0 deletions modules/gumgumBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ function buildRequests(validBidRequests, bidderRequest) {
const bids = [];
const gdprConsent = bidderRequest && bidderRequest.gdprConsent;
const uspConsent = bidderRequest && bidderRequest.uspConsent;
const gppConsent = bidderRequest && bidderRequest.gppConsent;
const timeout = config.getConfig('bidderTimeout');
const coppa = config.getConfig('coppa') === true ? 1 : 0;
const topWindowUrl = bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.page;
Expand Down Expand Up @@ -387,6 +388,17 @@ function buildRequests(validBidRequests, bidderRequest) {
if (uspConsent) {
data.uspConsent = uspConsent;
}
if (gppConsent) {
data.gppConsent = {
gppString: bidderRequest.gppConsent.gppString,
applicableSections: bidderRequest.gppConsent.applicableSections
}
} else if (!gppConsent && bidderRequest?.ortb2?.regs?.gpp) {
data.gppConsent = {
gppString: bidderRequest.ortb2.regs.gpp,
applicableSections: bidderRequest.ortb2.regs.gpp_sid
};
}
if (coppa) {
data.coppa = coppa;
}
Expand Down
40 changes: 40 additions & 0 deletions test/spec/modules/gumgumBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,46 @@ describe('gumgumAdapter', function () {
const bidRequest = spec.buildRequests(bidRequests, fakeBidRequest)[0];
expect(bidRequest.data).to.not.include.any.keys('gdprConsent')
});
it('should add gpp parameters if gppConsent is present', function () {
const gppConsent = { gppString: 'DBACNYA~CPXxRfAPXxRfAAfKABENB-CgAAAAAAAAAAYgAAAAAAAA~1YNN', applicableSections: [7] }
const fakeBidRequest = { gppConsent: gppConsent };
const bidRequest = spec.buildRequests(bidRequests, fakeBidRequest)[0];
expect(bidRequest.data.gppConsent).to.exist;
expect(bidRequest.data.gppConsent.gppString).to.equal(gppConsent.gppString);
expect(bidRequest.data.gppConsent.applicableSections).to.equal(gppConsent.applicableSections);
expect(bidRequest.data.gppConsent.gppString).to.eq('DBACNYA~CPXxRfAPXxRfAAfKABENB-CgAAAAAAAAAAYgAAAAAAAA~1YNN');
});
it('should handle ortb2 parameters', function () {
const ortb2 = {
regs: {
gpp: 'DBACNYA~CPXxRfAPXxRfAAfKABENB-CgAAAAAAAAAAYgAAAAAAAA~1YNN',
gpp_sid: [7]
}
}
const fakeBidRequest = { gppConsent: ortb2 };
const bidRequest = spec.buildRequests(bidRequests, fakeBidRequest)[0];
expect(bidRequest.data.gppConsent.gppString).to.eq(fakeBidRequest[0])
});
it('should handle gppConsent is present but values are undefined case', function () {
const gppConsent = { gppString: undefined, applicableSections: undefined }
const fakeBidRequest = { gppConsent: gppConsent };
const bidRequest = spec.buildRequests(bidRequests, fakeBidRequest)[0];
expect(bidRequest.data.gppConsent).to.exist;
expect(bidRequest.data.gppConsent.gppString).to.equal(undefined);
expect(bidRequest.data.gppConsent.applicableSections).to.equal(undefined);
});
it('should handle ortb2 undefined parameters', function () {
const ortb2 = {
regs: {
gpp: undefined,
gpp_sid: undefined
}
}
const fakeBidRequest = { gppConsent: ortb2 };
const bidRequest = spec.buildRequests(bidRequests, fakeBidRequest)[0];
expect(bidRequest.data.gppConsent.gppString).to.eq(undefined)
expect(bidRequest.data.gppConsent.applicableSections).to.eq(undefined)
});
it('should not set coppa parameter if coppa config is set to false', function () {
config.setConfig({
coppa: false
Expand Down