Skip to content

Commit

Permalink
gpp support
Browse files Browse the repository at this point in the history
  • Loading branch information
mobfxoHB committed Sep 26, 2023
1 parent b685406 commit 1778fe1
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
9 changes: 9 additions & 0 deletions modules/mobfoxpbBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,15 @@ export const spec = {
if (bidderRequest.gdprConsent) {
request.gdpr = bidderRequest.gdprConsent;
}

// Add GPP consent
if (bidderRequest.gppConsent) {
request.gpp = bidderRequest.gppConsent.gppString;
request.gpp_sid = bidderRequest.gppConsent.applicableSections;
} else if (bidderRequest.ortb2?.regs?.gpp) {
request.gpp = bidderRequest.ortb2.regs.gpp;
request.gpp_sid = bidderRequest.ortb2.regs.gpp_sid;
}
}

const len = validBidRequests.length;
Expand Down
33 changes: 32 additions & 1 deletion test/spec/modules/mobfoxpbBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ describe('MobfoxHBBidAdapter', function () {
const bidderRequest = {
refererInfo: {
referer: 'test.com'
}
},
ortb2: {}
};

describe('isBidRequestValid', function () {
Expand Down Expand Up @@ -143,6 +144,36 @@ describe('MobfoxHBBidAdapter', function () {
expect(data.placements).to.be.an('array').that.is.empty;
});
});

describe('gpp consent', function () {
it('bidderRequest.gppConsent', () => {
bidderRequest.gppConsent = {
gppString: 'abc123',
applicableSections: [8]
};

let serverRequest = spec.buildRequests([bid], bidderRequest);
let data = serverRequest.data;
expect(data).to.be.an('object');
expect(data).to.have.property('gpp');
expect(data).to.have.property('gpp_sid');

delete bidderRequest.gppConsent;
})

it('bidderRequest.ortb2.regs.gpp', () => {
bidderRequest.ortb2.regs = bidderRequest.ortb2.regs || {};
bidderRequest.ortb2.regs.gpp = 'abc123';
bidderRequest.ortb2.regs.gpp_sid = [8];

let serverRequest = spec.buildRequests([bid], bidderRequest);
let data = serverRequest.data;
expect(data).to.be.an('object');
expect(data).to.have.property('gpp');
expect(data).to.have.property('gpp_sid');
})
});

describe('interpretResponse', function () {
it('Should interpret banner response', function () {
const banner = {
Expand Down

0 comments on commit 1778fe1

Please sign in to comment.