Skip to content

Commit

Permalink
Added support for IAB segtax 7 in Rubicon bid adapter; Added unit tes…
Browse files Browse the repository at this point in the history
…t to verify segtax 7 functionality (#12794)
  • Loading branch information
apukh-magnite authored Feb 20, 2025
1 parent 5216f36 commit a344188
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion modules/rubiconBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ function applyFPD(bidRequest, mediaType, data) {

const gpid = deepAccess(bidRequest, 'ortb2Imp.ext.gpid');
const dsa = deepAccess(fpd, 'regs.ext.dsa');
const SEGTAX = {user: [4], site: [1, 2, 5, 6]};
const SEGTAX = {user: [4], site: [1, 2, 5, 6, 7]};
const MAP = {user: 'tg_v.', site: 'tg_i.', adserver: 'tg_i.dfp_ad_unit_code', pbadslot: 'tg_i.pbadslot', keywords: 'kw'};
const validate = function(prop, key, parentName) {
if (key === 'data' && Array.isArray(prop)) {
Expand Down
23 changes: 23 additions & 0 deletions test/spec/modules/rubiconBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2916,6 +2916,29 @@ describe('the rubicon adapter', function () {
expect(slotParams['tg_v.tax404']).is.equal(undefined);
});

it('should support IAB segtax 7 in site segments', () => {
const localBidderRequest = Object.assign({}, bidderRequest);
localBidderRequest.refererInfo = {domain: 'bob'};
config.setConfig({
rubicon: {
sendUserSegtax: [4],
sendSiteSegtax: [1, 2, 5, 6, 7]
}
});
localBidderRequest.ortb2.site = {
content: {
data: [{
ext: {
segtax: '7'
},
segment: [{id: 8}, {id: 9}]
}]
}
};
const slotParams = spec.createSlotParams(bidderRequest.bids[0], localBidderRequest);
expect(slotParams['tg_i.tax7']).to.equal('8,9');
});

it('should add p_site.mobile if mobile is a number in ortb2.site', function () {
// Set up a bidRequest with mobile property as a number
const localBidderRequest = Object.assign({}, bidderRequest);
Expand Down

0 comments on commit a344188

Please sign in to comment.