Skip to content

Commit

Permalink
Outbrain Bid Adapter - add gpp consent to bid request and User sync c…
Browse files Browse the repository at this point in the history
…alls (#10700)
  • Loading branch information
markkuhar authored Nov 9, 2023
1 parent ea5bc2c commit 9bfd688
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
13 changes: 12 additions & 1 deletion modules/outbrainBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,13 @@ export const spec = {
if (config.getConfig('coppa') === true) {
deepSetValue(request, 'regs.coppa', config.getConfig('coppa') & 1)
}
if (bidderRequest.gppConsent) {
deepSetValue(request, 'regs.ext.gpp', bidderRequest.gppConsent.gppString)
deepSetValue(request, 'regs.ext.gpp_sid', bidderRequest.gppConsent.applicableSections)
} else if (deepAccess(bidderRequest, 'ortb2.regs.gpp')) {
deepSetValue(request, 'regs.ext.gpp', bidderRequest.ortb2.regs.gpp)
deepSetValue(request, 'regs.ext.gpp_sid', bidderRequest.ortb2.regs.gpp_sid)
}

if (eids) {
deepSetValue(request, 'user.ext.eids', eids);
Expand Down Expand Up @@ -212,7 +219,7 @@ export const spec = {
}
}).filter(Boolean);
},
getUserSyncs: (syncOptions, responses, gdprConsent, uspConsent) => {
getUserSyncs: (syncOptions, responses, gdprConsent, uspConsent, gppConsent) => {
const syncs = [];
let syncUrl = config.getConfig('outbrain.usersyncUrl');

Expand All @@ -225,6 +232,10 @@ export const spec = {
if (uspConsent) {
query.push('us_privacy=' + encodeURIComponent(uspConsent));
}
if (gppConsent) {
query.push('gpp=' + encodeURIComponent(gppConsent.gppString));
query.push('gpp_sid=' + encodeURIComponent(gppConsent.applicableSections.join(',')));
}

syncs.push({
type: 'image',
Expand Down
30 changes: 29 additions & 1 deletion test/spec/modules/outbrainBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ describe('Outbrain Adapter', function () {
expect(resData.badv).to.deep.equal(['bad-advertiser'])
});

it('first party data', function () {
it('should pass first party data', function () {
const bidRequest = {
...commonBidRequest,
...nativeBidRequestParams,
Expand Down Expand Up @@ -508,6 +508,28 @@ describe('Outbrain Adapter', function () {
config.resetConfig()
});

it('should pass gpp information', function () {
const bidRequest = {
...commonBidRequest,
...nativeBidRequestParams,
};
const bidderRequest = {
...commonBidderRequest,
'gppConsent': {
'gppString': 'abc12345',
'applicableSections': [8]
}
}

const res = spec.buildRequests([bidRequest], bidderRequest);
const resData = JSON.parse(res.data);

expect(resData.regs.ext.gpp).to.exist;
expect(resData.regs.ext.gpp_sid).to.exist;
expect(resData.regs.ext.gpp).to.equal('abc12345');
expect(resData.regs.ext.gpp_sid).to.deep.equal([8]);
});

it('should pass extended ids', function () {
let bidRequest = {
bidId: 'bidId',
Expand Down Expand Up @@ -861,6 +883,12 @@ describe('Outbrain Adapter', function () {
type: 'image', url: `${usersyncUrl}?gdpr=1&gdpr_consent=foo&us_privacy=1NYN`
}]);
});

it('should pass gpp consent', function () {
expect(spec.getUserSyncs({ pixelEnabled: true }, {}, undefined, '', { gppString: 'abc12345', applicableSections: [1, 2] })).to.deep.equal([{
type: 'image', url: `${usersyncUrl}?gpp=abc12345&gpp_sid=1%2C2`
}]);
});
})

describe('onBidWon', function () {
Expand Down

0 comments on commit 9bfd688

Please sign in to comment.