From 6daebf348d67d1c7526cb463d0c411aedf036082 Mon Sep 17 00:00:00 2001 From: nouchy <33549554+nouchy@users.noreply.github.com> Date: Thu, 18 May 2023 17:20:29 +0200 Subject: [PATCH 1/4] bidder specific handling removal move bidder specific handling to ortb2 --- .gitignore | 2 + modules/sirdataRtdProvider.js | 107 ++++++---------- package-lock.json | 2 +- test/spec/modules/sirdataRtdProvider_spec.js | 127 ++++++++++++++++--- 4 files changed, 151 insertions(+), 87 deletions(-) diff --git a/.gitignore b/.gitignore index e5f000dd4d5..861bdb0f1e6 100644 --- a/.gitignore +++ b/.gitignore @@ -80,3 +80,5 @@ typings/ # MacOS system files .DS_Store +package-lock.json +package-lock.json diff --git a/modules/sirdataRtdProvider.js b/modules/sirdataRtdProvider.js index 40ee3d8b973..df2359a13b3 100644 --- a/modules/sirdataRtdProvider.js +++ b/modules/sirdataRtdProvider.js @@ -198,7 +198,7 @@ export function applyBidderOrtb2Sda(ortb2Fragments, bidder, type, segments, segt export function setBidderOrtb2(bidderOrtb2Fragments, bidder, path, segments) { try { - if (isEmpty(segments)) { return; } + if (isEmpty(segments)) { return false; } let ortb2Conf = {}; deepSetValue(ortb2Conf, path, segments || {}); mergeDeep(bidderOrtb2Fragments, {[bidder]: ortb2Conf}); @@ -254,7 +254,7 @@ export function getSegAndCatsArray(data, minScore, pid) { return sirdataData; } -export function applySdaGetSpecificData(data, sirdataList, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit) { +export function applySdaGetSpecificData(data, sirdataData, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit) { // only share SDA data if whitelisted if (!biddersParamsExist || indexFound) { // SDA Publisher @@ -269,7 +269,8 @@ export function applySdaGetSpecificData(data, sirdataList, biddersParamsExist, m if (data.shared_taxonomy && data.shared_taxonomy[curationId]) { // Get Bidder Specific Data let curationData = getSegAndCatsArray(data.shared_taxonomy[curationId], minScore, null); - sirdataList = sirdataList.concat(curationData.segments).concat(curationData.categories); + sirdataData.segments = sirdataData.segments.concat(curationData.segments); + sirdataData.categories = sirdataData.categories.concat(curationData.categories); // SDA Partners let curationDataForSDA = getSegAndCatsArray(data.shared_taxonomy[curationId], minScore, curationId); @@ -278,19 +279,22 @@ export function applySdaGetSpecificData(data, sirdataList, biddersParamsExist, m } // Apply custom function or return Bidder Specific Data if publisher is ok - if (sirdataList && sirdataList.length > 0 && (!biddersParamsExist || indexFound)) { + if (!biddersParamsExist || indexFound) { if (indexFound && moduleConfig.params.bidders[bidderIndex].hasOwnProperty('customFunction')) { - return loadCustomFunction(moduleConfig.params.bidders[bidderIndex].customFunction, adUnit, sirdataList, data, bid); + return loadCustomFunction(moduleConfig.params.bidders[bidderIndex].customFunction, adUnit, sirdataData, data, bid); } else { - return sirdataList; + return sirdataData; } } } -export function applySdaAndDefaultSpecificData(data, sirdataList, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit) { - let specificData = applySdaGetSpecificData(data, sirdataList, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); - if (specificData && specificData.length > 0) { - setBidderOrtb2(reqBids.ortb2Fragments?.bidder, bid.bidder, 'user.ext.data', {sd_rtd: specificData}); +export function applySdaAndDefaultSpecificData(data, sirdataData, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit) { + sirdataData = applySdaGetSpecificData(data, sirdataData, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); + if (sirdataData.segments && sirdataData.segments.length > 0) { + setBidderOrtb2(reqBids.ortb2Fragments?.bidder, bid.bidder, 'user.ext.data', {sd_rtd: sirdataData.segments}); + } + if (sirdataData.categories && sirdataData.categories.length > 0) { + setBidderOrtb2(reqBids.ortb2Fragments?.bidder, bid.bidder, 'site.ext.data', {sd_rtd: sirdataData.categories}); } } @@ -301,8 +305,6 @@ export function addSegmentData(reqBids, data, moduleConfig, onDone) { const globalMinScore = moduleConfig.params.hasOwnProperty('contextualMinRelevancyScore') ? moduleConfig.params.contextualMinRelevancyScore : 30; var sirdataData = getSegAndCatsArray(data, globalMinScore, null); - const sirdataList = sirdataData.segments.concat(sirdataData.categories); - const biddersParamsExist = (!!(moduleConfig.params && moduleConfig.params.bidders)); // Global ortb2 SDA @@ -320,15 +322,17 @@ export function addSegmentData(reqBids, data, moduleConfig, onDone) { if (typeof window.googletag !== 'undefined' && (moduleConfig.params.setGptKeyValues || !moduleConfig.params.hasOwnProperty('setGptKeyValues'))) { try { let gptCurationId = (moduleConfig.params.gptCurationId ? moduleConfig.params.gptCurationId : (partnerIds['sdRtdForGpt'] ? partnerIds['sdRtdForGpt'] : null)); - let sirdataMergedList = sirdataList; + let sirdataMergedList = sirdataData.segments.concat(sirdataData.categories); if (gptCurationId && data.shared_taxonomy && data.shared_taxonomy[gptCurationId]) { let gamCurationData = getSegAndCatsArray(data.shared_taxonomy[gptCurationId], globalMinScore, null); sirdataMergedList = sirdataMergedList.concat(gamCurationData.segments).concat(gamCurationData.categories); } - window.googletag.pubads().getSlots().forEach(function (n) { - if (typeof n.setTargeting !== 'undefined' && sirdataMergedList && sirdataMergedList.length > 0) { - n.setTargeting('sd_rtd', sirdataMergedList); - } + window.googletag.cmd.push(function() { + window.googletag.pubads().getSlots().forEach(function (n) { + if (typeof n.setTargeting !== 'undefined' && sirdataMergedList && sirdataMergedList.length > 0) { + n.setTargeting('sd_rtd', sirdataMergedList); + } + }); }); } catch (e) { logError(e); @@ -340,10 +344,6 @@ export function addSegmentData(reqBids, data, moduleConfig, onDone) { var indexFound = false; adUnits.forEach(adUnit => { - if (!biddersParamsExist && !deepAccess(adUnit, 'ortb2Imp.ext.data.sd_rtd')) { - deepSetValue(adUnit, 'ortb2Imp.ext.data.sd_rtd', sirdataList); - } - adUnit.hasOwnProperty('bids') && adUnit.bids.forEach(bid => { bidderIndex = (moduleConfig.params.hasOwnProperty('bidders') ? findIndex(moduleConfig.params.bidders, function (i) { return i.bidder === bid.bidder; @@ -351,7 +351,6 @@ export function addSegmentData(reqBids, data, moduleConfig, onDone) { indexFound = (!!(typeof bidderIndex == 'number' && bidderIndex >= 0)); try { let minScore = (indexFound && moduleConfig.params.bidders[bidderIndex].hasOwnProperty('contextualMinRelevancyScore') ? moduleConfig.params.bidders[bidderIndex].contextualMinRelevancyScore : globalMinScore); - let specificData = null; switch (bid.bidder) { case 'appnexus': @@ -370,57 +369,24 @@ export function addSegmentData(reqBids, data, moduleConfig, onDone) { case 'msq_classic': case 'msq_max': case '366_apx': - specificData = applySdaGetSpecificData(data, sirdataList, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); - if (specificData && specificData.length > 0) { - deepSetValue(bid, 'params.keywords.sd_rtd', specificData); + sirdataData = applySdaGetSpecificData(data, sirdataData, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); + if (sirdataData.segments && sirdataData.segments.length > 0) { + setBidderOrtb2(reqBids.ortb2Fragments?.bidder, bid.bidder, 'user.keywords', 'sd_rtd=' + sirdataData.segments.join(',sd_rtd=')); } - break; - - case 'smartadserver': - case 'smart': - specificData = applySdaGetSpecificData(data, sirdataList, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); - if (specificData && specificData.length > 0) { - var target = []; - if (bid.hasOwnProperty('params') && bid.params.hasOwnProperty('target')) { - target.push(bid.params.target); - } - specificData.forEach(function (entry) { - if (target.indexOf('sd_rtd=' + entry) === -1) { - target.push('sd_rtd=' + entry); - } - }); - deepSetValue(bid, 'params.target', target.join(';')); - } - break; - - case 'ix': - specificData = applySdaGetSpecificData(data, sirdataList, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); - let ixConfig = config.getConfig('ix.firstPartyData.sd_rtd'); - if (!ixConfig && specificData && specificData.length > 0) { - let cappIxCategories = []; - let ixLength = 0; - let ixLimit = (indexFound && moduleConfig.params.bidders[bidderIndex].hasOwnProperty('sizeLimit') ? moduleConfig.params.bidders[bidderIndex].sizeLimit : 1000); - // Push ids For publisher use and for curation if exists but limit size because the bidder uses GET parameters - specificData.forEach(function (entry) { - if (ixLength < ixLimit) { - cappIxCategories.push(entry); - ixLength += entry.toString().length; - } - }); - config.setConfig({ix: {firstPartyData: {sd_rtd: cappIxCategories}}}); + if (sirdataData.categories && sirdataData.categories.length > 0) { + setBidderOrtb2(reqBids.ortb2Fragments?.bidder, bid.bidder, 'site.content.keywords', 'sd_rtd=' + sirdataData.categories.join(',sd_rtd=')); } break; case 'proxistore': - specificData = applySdaGetSpecificData(data, sirdataList, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); - if (specificData && specificData.length > 0) { - let psCurationId = (indexFound && moduleConfig.params.bidders[bidderIndex].hasOwnProperty('curationId') ? moduleConfig.params.bidders[bidderIndex].curationId : (partnerIds[bid.bidder] ? partnerIds[bid.bidder] : null)); - if (!data.shared_taxonomy || !data.shared_taxonomy[psCurationId]) { - data.shared_taxonomy[psCurationId] = {segments: [], contextual_categories: {}, segtaxid: null, cattaxid: null}; - } - let psCurationData = getSegAndCatsArray(data.shared_taxonomy[psCurationId], minScore, null); + sirdataData = applySdaGetSpecificData(data, sirdataData, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); + let psCurationId = (indexFound && moduleConfig.params.bidders[bidderIndex].hasOwnProperty('curationId') ? moduleConfig.params.bidders[bidderIndex].curationId : (partnerIds[bid.bidder] ? partnerIds[bid.bidder] : null)); + if (!data.shared_taxonomy || !data.shared_taxonomy[psCurationId]) { + data.shared_taxonomy[psCurationId] = {segments: [], contextual_categories: {}, segtaxid: null, cattaxid: null}; + } + if ((sirdataData.segments && sirdataData.segments.length > 0) || (sirdataData.categories && sirdataData.categories.length > 0)) { setBidderOrtb2(reqBids.ortb2Fragments?.bidder, bid.bidder, 'user.ext.data', { - segments: sirdataData.segments.concat(psCurationData.segments), + segments: sirdataData.segments, contextual_categories: {...data.contextual_categories, ...data.shared_taxonomy[psCurationId].contextual_categories} }); } @@ -445,12 +411,15 @@ export function addSegmentData(reqBids, data, moduleConfig, onDone) { case 'sublime': case 'rtbhouse': case 'mediasquare': - applySdaAndDefaultSpecificData(data, sirdataList, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); + case 'smartadserver': + case 'smart': + case 'ix': + applySdaAndDefaultSpecificData(data, sirdataData, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); break; default: if (!biddersParamsExist || (indexFound && (!moduleConfig.params.bidders[bidderIndex].hasOwnProperty('adUnitCodes') || moduleConfig.params.bidders[bidderIndex].adUnitCodes.indexOf(adUnit.code) !== -1))) { - applySdaAndDefaultSpecificData(data, sirdataList, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); + applySdaAndDefaultSpecificData(data, sirdataData, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); } } } catch (e) { diff --git a/package-lock.json b/package-lock.json index a6e6020a443..57c94df0732 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,7 @@ "packages": { "": { "name": "prebid.js", - "version": "7.48.0-pre", + "version": "7.50.0-pre", "license": "Apache-2.0", "dependencies": { "@babel/core": "^7.16.7", diff --git a/test/spec/modules/sirdataRtdProvider_spec.js b/test/spec/modules/sirdataRtdProvider_spec.js index eccc4777906..f4244fc8414 100644 --- a/test/spec/modules/sirdataRtdProvider_spec.js +++ b/test/spec/modules/sirdataRtdProvider_spec.js @@ -1,26 +1,31 @@ -import {addSegmentData, getSegmentsAndCategories, sirdataSubmodule} from 'modules/sirdataRtdProvider.js'; +import {addSegmentData, getSegmentsAndCategories, sirdataSubmodule, setBidderOrtb2} from 'modules/sirdataRtdProvider.js'; import {server} from 'test/mocks/xhr.js'; const responseHeader = {'Content-Type': 'application/json'}; describe('sirdataRtdProvider', function () { describe('sirdataSubmodule', function () { + it('exists', function () { + expect(sirdataSubmodule.init).to.be.a('function'); + }); it('successfully instantiates', function () { expect(sirdataSubmodule.init()).to.equal(true); }); + it('has the correct module name', function () { + expect(sirdataSubmodule.name).to.equal('SirdataRTDModule'); + }); }); describe('Add Segment Data', function () { it('adds segment data', function () { - const config = { + const firstConfig = { params: { - setGptKeyValues: false, + partnerId: 1, + key: 1, + setGptKeyValues: true, + gptCurationId: 27449, contextualMinRelevancyScore: 50, - bidders: [{ - bidder: 'appnexus' - }, { - bidder: 'other' - }] + bidders: [] } }; @@ -37,21 +42,47 @@ describe('sirdataRtdProvider', function () { } ]; - let data = { + let firstReqBidsConfigObj = { + adUnits: adUnits, + ortb2Fragments: { + global: {} + } + }; + + let firstData = { segments: [111111, 222222], - contextual_categories: {'333333': 100} + contextual_categories: {'333333': 100}, + 'segtaxid': null, + 'cattaxid': null, + 'shared_taxonomy': { + '27449': { + 'segments': [444444, 555555], + 'segtaxid': null, + 'cattaxid': null, + 'contextual_categories': {'666666': 100} + } + }, + 'global_taxonomy': { + '9998': { + 'segments': [123, 234], + 'segtaxid': 4, + 'cattaxid': 7, + 'contextual_categories': {'345': 100, '456': 100} + } + } }; - addSegmentData({adUnits}, data, config, () => { + addSegmentData(firstReqBidsConfigObj, firstData, firstConfig, () => { }); - expect(adUnits[0].bids[0].params.keywords).to.have.deep.property('sd_rtd', ['111111', '222222', '333333']); + + expect(firstReqBidsConfigObj.ortb2Fragments.global.user.data[0].ext.segtax).to.equal(4); }); }); describe('Get Segments And Categories', function () { it('gets data from async request and adds segment data', function () { const overrideAppnexus = function (adUnit, list, data, bid) { - deepSetValue(bid, 'params.keywords.custom', list); + deepSetValue(bid, 'params.keywords.custom', list.segments.concat(list.categories)); } const config = { @@ -60,16 +91,21 @@ describe('sirdataRtdProvider', function () { contextualMinRelevancyScore: 50, bidders: [{ bidder: 'appnexus', - customFunction: overrideAppnexus + customFunction: overrideAppnexus, + curationId: 27446 }, { - bidder: 'smartadserver' + bidder: 'smartadserver', + curationId: 27440 }, { bidder: 'ix', sizeLimit: 1200, + curationId: 27248 }, { bidder: 'rubicon', + curationId: 27452 }, { bidder: 'proxistore', + curationId: 27484 }] } }; @@ -146,6 +182,12 @@ describe('sirdataRtdProvider', function () { 'segtaxid': 552, 'cattaxid': 553, 'contextual_categories': {'666666': 100} + }, + '27446': { + 'segments': [777777, 888888], + 'segtaxid': 552, + 'cattaxid': 553, + 'contextual_categories': {'999999': 100} } }, 'global_taxonomy': { @@ -164,8 +206,6 @@ describe('sirdataRtdProvider', function () { let request = server.requests[0]; request.respond(200, responseHeader, JSON.stringify(data)); - expect(reqBidsConfigObj.adUnits[0].bids[1].params).to.have.deep.property('target', 'sd_rtd=111111;sd_rtd=222222;sd_rtd=333333;sd_rtd=444444;sd_rtd=555555;sd_rtd=666666'); - expect(reqBidsConfigObj.ortb2Fragments.global.site.content.data[0].name).to.equal( 'sirdata.com' ); @@ -185,4 +225,57 @@ describe('sirdataRtdProvider', function () { expect(reqBidsConfigObj.ortb2Fragments.global.user.data[0].ext.segtax).to.equal(4); }); }); + + describe('Set ortb2 for bidder', function () { + it('set ortb2 for a givent bidder', function () { + const config = { + params: { + setGptKeyValues: false, + contextualMinRelevancyScore: 50, + bidders: [{ + bidder: 'appnexus', + }] + } + }; + + let reqBidsConfigObj = { + adUnits: [{ + bids: [{ + bidder: 'appnexus', + params: { + placementId: 13144370 + } + }] + }], + ortb2Fragments: { + global: {} + } + }; + + let data = { + 'segments': [111111, 222222], + 'segtaxid': null, + 'cattaxid': null, + 'contextual_categories': {'333333': 100}, + 'shared_taxonomy': { + '27440': { + 'segments': [444444, 555555], + 'segtaxid': null, + 'cattaxid': null, + 'contextual_categories': {'666666': 100} + } + }, + 'global_taxonomy': {} + }; + + window.googletag = window.googletag || {}; + window.googletag.cmd = window.googletag.cmd || []; + + let test = setBidderOrtb2(reqBidsConfigObj.ortb2Fragments, 'appnexus', 'user', []); + expect(test).to.be.false; + + test = setBidderOrtb2(reqBidsConfigObj.ortb2Fragments, 'appnexus', 'user', ['1']); + expect(test).to.be.true; + }); + }); }); From e3f3666f38786ea36cadf0a5960736533e64eb7e Mon Sep 17 00:00:00 2001 From: nouchy <33549554+nouchy@users.noreply.github.com> Date: Thu, 18 May 2023 20:43:30 +0200 Subject: [PATCH 2/4] Revert "bidder specific handling removal" This reverts commit 6daebf348d67d1c7526cb463d0c411aedf036082. --- .gitignore | 2 - modules/sirdataRtdProvider.js | 107 ++++++++++------ package-lock.json | 2 +- test/spec/modules/sirdataRtdProvider_spec.js | 127 +++---------------- 4 files changed, 87 insertions(+), 151 deletions(-) diff --git a/.gitignore b/.gitignore index 861bdb0f1e6..e5f000dd4d5 100644 --- a/.gitignore +++ b/.gitignore @@ -80,5 +80,3 @@ typings/ # MacOS system files .DS_Store -package-lock.json -package-lock.json diff --git a/modules/sirdataRtdProvider.js b/modules/sirdataRtdProvider.js index df2359a13b3..40ee3d8b973 100644 --- a/modules/sirdataRtdProvider.js +++ b/modules/sirdataRtdProvider.js @@ -198,7 +198,7 @@ export function applyBidderOrtb2Sda(ortb2Fragments, bidder, type, segments, segt export function setBidderOrtb2(bidderOrtb2Fragments, bidder, path, segments) { try { - if (isEmpty(segments)) { return false; } + if (isEmpty(segments)) { return; } let ortb2Conf = {}; deepSetValue(ortb2Conf, path, segments || {}); mergeDeep(bidderOrtb2Fragments, {[bidder]: ortb2Conf}); @@ -254,7 +254,7 @@ export function getSegAndCatsArray(data, minScore, pid) { return sirdataData; } -export function applySdaGetSpecificData(data, sirdataData, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit) { +export function applySdaGetSpecificData(data, sirdataList, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit) { // only share SDA data if whitelisted if (!biddersParamsExist || indexFound) { // SDA Publisher @@ -269,8 +269,7 @@ export function applySdaGetSpecificData(data, sirdataData, biddersParamsExist, m if (data.shared_taxonomy && data.shared_taxonomy[curationId]) { // Get Bidder Specific Data let curationData = getSegAndCatsArray(data.shared_taxonomy[curationId], minScore, null); - sirdataData.segments = sirdataData.segments.concat(curationData.segments); - sirdataData.categories = sirdataData.categories.concat(curationData.categories); + sirdataList = sirdataList.concat(curationData.segments).concat(curationData.categories); // SDA Partners let curationDataForSDA = getSegAndCatsArray(data.shared_taxonomy[curationId], minScore, curationId); @@ -279,22 +278,19 @@ export function applySdaGetSpecificData(data, sirdataData, biddersParamsExist, m } // Apply custom function or return Bidder Specific Data if publisher is ok - if (!biddersParamsExist || indexFound) { + if (sirdataList && sirdataList.length > 0 && (!biddersParamsExist || indexFound)) { if (indexFound && moduleConfig.params.bidders[bidderIndex].hasOwnProperty('customFunction')) { - return loadCustomFunction(moduleConfig.params.bidders[bidderIndex].customFunction, adUnit, sirdataData, data, bid); + return loadCustomFunction(moduleConfig.params.bidders[bidderIndex].customFunction, adUnit, sirdataList, data, bid); } else { - return sirdataData; + return sirdataList; } } } -export function applySdaAndDefaultSpecificData(data, sirdataData, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit) { - sirdataData = applySdaGetSpecificData(data, sirdataData, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); - if (sirdataData.segments && sirdataData.segments.length > 0) { - setBidderOrtb2(reqBids.ortb2Fragments?.bidder, bid.bidder, 'user.ext.data', {sd_rtd: sirdataData.segments}); - } - if (sirdataData.categories && sirdataData.categories.length > 0) { - setBidderOrtb2(reqBids.ortb2Fragments?.bidder, bid.bidder, 'site.ext.data', {sd_rtd: sirdataData.categories}); +export function applySdaAndDefaultSpecificData(data, sirdataList, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit) { + let specificData = applySdaGetSpecificData(data, sirdataList, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); + if (specificData && specificData.length > 0) { + setBidderOrtb2(reqBids.ortb2Fragments?.bidder, bid.bidder, 'user.ext.data', {sd_rtd: specificData}); } } @@ -305,6 +301,8 @@ export function addSegmentData(reqBids, data, moduleConfig, onDone) { const globalMinScore = moduleConfig.params.hasOwnProperty('contextualMinRelevancyScore') ? moduleConfig.params.contextualMinRelevancyScore : 30; var sirdataData = getSegAndCatsArray(data, globalMinScore, null); + const sirdataList = sirdataData.segments.concat(sirdataData.categories); + const biddersParamsExist = (!!(moduleConfig.params && moduleConfig.params.bidders)); // Global ortb2 SDA @@ -322,17 +320,15 @@ export function addSegmentData(reqBids, data, moduleConfig, onDone) { if (typeof window.googletag !== 'undefined' && (moduleConfig.params.setGptKeyValues || !moduleConfig.params.hasOwnProperty('setGptKeyValues'))) { try { let gptCurationId = (moduleConfig.params.gptCurationId ? moduleConfig.params.gptCurationId : (partnerIds['sdRtdForGpt'] ? partnerIds['sdRtdForGpt'] : null)); - let sirdataMergedList = sirdataData.segments.concat(sirdataData.categories); + let sirdataMergedList = sirdataList; if (gptCurationId && data.shared_taxonomy && data.shared_taxonomy[gptCurationId]) { let gamCurationData = getSegAndCatsArray(data.shared_taxonomy[gptCurationId], globalMinScore, null); sirdataMergedList = sirdataMergedList.concat(gamCurationData.segments).concat(gamCurationData.categories); } - window.googletag.cmd.push(function() { - window.googletag.pubads().getSlots().forEach(function (n) { - if (typeof n.setTargeting !== 'undefined' && sirdataMergedList && sirdataMergedList.length > 0) { - n.setTargeting('sd_rtd', sirdataMergedList); - } - }); + window.googletag.pubads().getSlots().forEach(function (n) { + if (typeof n.setTargeting !== 'undefined' && sirdataMergedList && sirdataMergedList.length > 0) { + n.setTargeting('sd_rtd', sirdataMergedList); + } }); } catch (e) { logError(e); @@ -344,6 +340,10 @@ export function addSegmentData(reqBids, data, moduleConfig, onDone) { var indexFound = false; adUnits.forEach(adUnit => { + if (!biddersParamsExist && !deepAccess(adUnit, 'ortb2Imp.ext.data.sd_rtd')) { + deepSetValue(adUnit, 'ortb2Imp.ext.data.sd_rtd', sirdataList); + } + adUnit.hasOwnProperty('bids') && adUnit.bids.forEach(bid => { bidderIndex = (moduleConfig.params.hasOwnProperty('bidders') ? findIndex(moduleConfig.params.bidders, function (i) { return i.bidder === bid.bidder; @@ -351,6 +351,7 @@ export function addSegmentData(reqBids, data, moduleConfig, onDone) { indexFound = (!!(typeof bidderIndex == 'number' && bidderIndex >= 0)); try { let minScore = (indexFound && moduleConfig.params.bidders[bidderIndex].hasOwnProperty('contextualMinRelevancyScore') ? moduleConfig.params.bidders[bidderIndex].contextualMinRelevancyScore : globalMinScore); + let specificData = null; switch (bid.bidder) { case 'appnexus': @@ -369,24 +370,57 @@ export function addSegmentData(reqBids, data, moduleConfig, onDone) { case 'msq_classic': case 'msq_max': case '366_apx': - sirdataData = applySdaGetSpecificData(data, sirdataData, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); - if (sirdataData.segments && sirdataData.segments.length > 0) { - setBidderOrtb2(reqBids.ortb2Fragments?.bidder, bid.bidder, 'user.keywords', 'sd_rtd=' + sirdataData.segments.join(',sd_rtd=')); + specificData = applySdaGetSpecificData(data, sirdataList, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); + if (specificData && specificData.length > 0) { + deepSetValue(bid, 'params.keywords.sd_rtd', specificData); } - if (sirdataData.categories && sirdataData.categories.length > 0) { - setBidderOrtb2(reqBids.ortb2Fragments?.bidder, bid.bidder, 'site.content.keywords', 'sd_rtd=' + sirdataData.categories.join(',sd_rtd=')); + break; + + case 'smartadserver': + case 'smart': + specificData = applySdaGetSpecificData(data, sirdataList, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); + if (specificData && specificData.length > 0) { + var target = []; + if (bid.hasOwnProperty('params') && bid.params.hasOwnProperty('target')) { + target.push(bid.params.target); + } + specificData.forEach(function (entry) { + if (target.indexOf('sd_rtd=' + entry) === -1) { + target.push('sd_rtd=' + entry); + } + }); + deepSetValue(bid, 'params.target', target.join(';')); } break; - case 'proxistore': - sirdataData = applySdaGetSpecificData(data, sirdataData, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); - let psCurationId = (indexFound && moduleConfig.params.bidders[bidderIndex].hasOwnProperty('curationId') ? moduleConfig.params.bidders[bidderIndex].curationId : (partnerIds[bid.bidder] ? partnerIds[bid.bidder] : null)); - if (!data.shared_taxonomy || !data.shared_taxonomy[psCurationId]) { - data.shared_taxonomy[psCurationId] = {segments: [], contextual_categories: {}, segtaxid: null, cattaxid: null}; + case 'ix': + specificData = applySdaGetSpecificData(data, sirdataList, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); + let ixConfig = config.getConfig('ix.firstPartyData.sd_rtd'); + if (!ixConfig && specificData && specificData.length > 0) { + let cappIxCategories = []; + let ixLength = 0; + let ixLimit = (indexFound && moduleConfig.params.bidders[bidderIndex].hasOwnProperty('sizeLimit') ? moduleConfig.params.bidders[bidderIndex].sizeLimit : 1000); + // Push ids For publisher use and for curation if exists but limit size because the bidder uses GET parameters + specificData.forEach(function (entry) { + if (ixLength < ixLimit) { + cappIxCategories.push(entry); + ixLength += entry.toString().length; + } + }); + config.setConfig({ix: {firstPartyData: {sd_rtd: cappIxCategories}}}); } - if ((sirdataData.segments && sirdataData.segments.length > 0) || (sirdataData.categories && sirdataData.categories.length > 0)) { + break; + + case 'proxistore': + specificData = applySdaGetSpecificData(data, sirdataList, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); + if (specificData && specificData.length > 0) { + let psCurationId = (indexFound && moduleConfig.params.bidders[bidderIndex].hasOwnProperty('curationId') ? moduleConfig.params.bidders[bidderIndex].curationId : (partnerIds[bid.bidder] ? partnerIds[bid.bidder] : null)); + if (!data.shared_taxonomy || !data.shared_taxonomy[psCurationId]) { + data.shared_taxonomy[psCurationId] = {segments: [], contextual_categories: {}, segtaxid: null, cattaxid: null}; + } + let psCurationData = getSegAndCatsArray(data.shared_taxonomy[psCurationId], minScore, null); setBidderOrtb2(reqBids.ortb2Fragments?.bidder, bid.bidder, 'user.ext.data', { - segments: sirdataData.segments, + segments: sirdataData.segments.concat(psCurationData.segments), contextual_categories: {...data.contextual_categories, ...data.shared_taxonomy[psCurationId].contextual_categories} }); } @@ -411,15 +445,12 @@ export function addSegmentData(reqBids, data, moduleConfig, onDone) { case 'sublime': case 'rtbhouse': case 'mediasquare': - case 'smartadserver': - case 'smart': - case 'ix': - applySdaAndDefaultSpecificData(data, sirdataData, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); + applySdaAndDefaultSpecificData(data, sirdataList, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); break; default: if (!biddersParamsExist || (indexFound && (!moduleConfig.params.bidders[bidderIndex].hasOwnProperty('adUnitCodes') || moduleConfig.params.bidders[bidderIndex].adUnitCodes.indexOf(adUnit.code) !== -1))) { - applySdaAndDefaultSpecificData(data, sirdataData, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); + applySdaAndDefaultSpecificData(data, sirdataList, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); } } } catch (e) { diff --git a/package-lock.json b/package-lock.json index 57c94df0732..a6e6020a443 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,7 @@ "packages": { "": { "name": "prebid.js", - "version": "7.50.0-pre", + "version": "7.48.0-pre", "license": "Apache-2.0", "dependencies": { "@babel/core": "^7.16.7", diff --git a/test/spec/modules/sirdataRtdProvider_spec.js b/test/spec/modules/sirdataRtdProvider_spec.js index f4244fc8414..eccc4777906 100644 --- a/test/spec/modules/sirdataRtdProvider_spec.js +++ b/test/spec/modules/sirdataRtdProvider_spec.js @@ -1,31 +1,26 @@ -import {addSegmentData, getSegmentsAndCategories, sirdataSubmodule, setBidderOrtb2} from 'modules/sirdataRtdProvider.js'; +import {addSegmentData, getSegmentsAndCategories, sirdataSubmodule} from 'modules/sirdataRtdProvider.js'; import {server} from 'test/mocks/xhr.js'; const responseHeader = {'Content-Type': 'application/json'}; describe('sirdataRtdProvider', function () { describe('sirdataSubmodule', function () { - it('exists', function () { - expect(sirdataSubmodule.init).to.be.a('function'); - }); it('successfully instantiates', function () { expect(sirdataSubmodule.init()).to.equal(true); }); - it('has the correct module name', function () { - expect(sirdataSubmodule.name).to.equal('SirdataRTDModule'); - }); }); describe('Add Segment Data', function () { it('adds segment data', function () { - const firstConfig = { + const config = { params: { - partnerId: 1, - key: 1, - setGptKeyValues: true, - gptCurationId: 27449, + setGptKeyValues: false, contextualMinRelevancyScore: 50, - bidders: [] + bidders: [{ + bidder: 'appnexus' + }, { + bidder: 'other' + }] } }; @@ -42,47 +37,21 @@ describe('sirdataRtdProvider', function () { } ]; - let firstReqBidsConfigObj = { - adUnits: adUnits, - ortb2Fragments: { - global: {} - } - }; - - let firstData = { + let data = { segments: [111111, 222222], - contextual_categories: {'333333': 100}, - 'segtaxid': null, - 'cattaxid': null, - 'shared_taxonomy': { - '27449': { - 'segments': [444444, 555555], - 'segtaxid': null, - 'cattaxid': null, - 'contextual_categories': {'666666': 100} - } - }, - 'global_taxonomy': { - '9998': { - 'segments': [123, 234], - 'segtaxid': 4, - 'cattaxid': 7, - 'contextual_categories': {'345': 100, '456': 100} - } - } + contextual_categories: {'333333': 100} }; - addSegmentData(firstReqBidsConfigObj, firstData, firstConfig, () => { + addSegmentData({adUnits}, data, config, () => { }); - - expect(firstReqBidsConfigObj.ortb2Fragments.global.user.data[0].ext.segtax).to.equal(4); + expect(adUnits[0].bids[0].params.keywords).to.have.deep.property('sd_rtd', ['111111', '222222', '333333']); }); }); describe('Get Segments And Categories', function () { it('gets data from async request and adds segment data', function () { const overrideAppnexus = function (adUnit, list, data, bid) { - deepSetValue(bid, 'params.keywords.custom', list.segments.concat(list.categories)); + deepSetValue(bid, 'params.keywords.custom', list); } const config = { @@ -91,21 +60,16 @@ describe('sirdataRtdProvider', function () { contextualMinRelevancyScore: 50, bidders: [{ bidder: 'appnexus', - customFunction: overrideAppnexus, - curationId: 27446 + customFunction: overrideAppnexus }, { - bidder: 'smartadserver', - curationId: 27440 + bidder: 'smartadserver' }, { bidder: 'ix', sizeLimit: 1200, - curationId: 27248 }, { bidder: 'rubicon', - curationId: 27452 }, { bidder: 'proxistore', - curationId: 27484 }] } }; @@ -182,12 +146,6 @@ describe('sirdataRtdProvider', function () { 'segtaxid': 552, 'cattaxid': 553, 'contextual_categories': {'666666': 100} - }, - '27446': { - 'segments': [777777, 888888], - 'segtaxid': 552, - 'cattaxid': 553, - 'contextual_categories': {'999999': 100} } }, 'global_taxonomy': { @@ -206,6 +164,8 @@ describe('sirdataRtdProvider', function () { let request = server.requests[0]; request.respond(200, responseHeader, JSON.stringify(data)); + expect(reqBidsConfigObj.adUnits[0].bids[1].params).to.have.deep.property('target', 'sd_rtd=111111;sd_rtd=222222;sd_rtd=333333;sd_rtd=444444;sd_rtd=555555;sd_rtd=666666'); + expect(reqBidsConfigObj.ortb2Fragments.global.site.content.data[0].name).to.equal( 'sirdata.com' ); @@ -225,57 +185,4 @@ describe('sirdataRtdProvider', function () { expect(reqBidsConfigObj.ortb2Fragments.global.user.data[0].ext.segtax).to.equal(4); }); }); - - describe('Set ortb2 for bidder', function () { - it('set ortb2 for a givent bidder', function () { - const config = { - params: { - setGptKeyValues: false, - contextualMinRelevancyScore: 50, - bidders: [{ - bidder: 'appnexus', - }] - } - }; - - let reqBidsConfigObj = { - adUnits: [{ - bids: [{ - bidder: 'appnexus', - params: { - placementId: 13144370 - } - }] - }], - ortb2Fragments: { - global: {} - } - }; - - let data = { - 'segments': [111111, 222222], - 'segtaxid': null, - 'cattaxid': null, - 'contextual_categories': {'333333': 100}, - 'shared_taxonomy': { - '27440': { - 'segments': [444444, 555555], - 'segtaxid': null, - 'cattaxid': null, - 'contextual_categories': {'666666': 100} - } - }, - 'global_taxonomy': {} - }; - - window.googletag = window.googletag || {}; - window.googletag.cmd = window.googletag.cmd || []; - - let test = setBidderOrtb2(reqBidsConfigObj.ortb2Fragments, 'appnexus', 'user', []); - expect(test).to.be.false; - - test = setBidderOrtb2(reqBidsConfigObj.ortb2Fragments, 'appnexus', 'user', ['1']); - expect(test).to.be.true; - }); - }); }); From 54515e02c7140194b373332a7598bd14e066f7ce Mon Sep 17 00:00:00 2001 From: nouchy <33549554+nouchy@users.noreply.github.com> Date: Thu, 18 May 2023 20:46:49 +0200 Subject: [PATCH 3/4] bidder specific handling removal move bidder specific handling to ortb2 --- modules/sirdataRtdProvider.js | 107 ++++++---------- test/spec/modules/sirdataRtdProvider_spec.js | 127 ++++++++++++++++--- 2 files changed, 148 insertions(+), 86 deletions(-) diff --git a/modules/sirdataRtdProvider.js b/modules/sirdataRtdProvider.js index 40ee3d8b973..df2359a13b3 100644 --- a/modules/sirdataRtdProvider.js +++ b/modules/sirdataRtdProvider.js @@ -198,7 +198,7 @@ export function applyBidderOrtb2Sda(ortb2Fragments, bidder, type, segments, segt export function setBidderOrtb2(bidderOrtb2Fragments, bidder, path, segments) { try { - if (isEmpty(segments)) { return; } + if (isEmpty(segments)) { return false; } let ortb2Conf = {}; deepSetValue(ortb2Conf, path, segments || {}); mergeDeep(bidderOrtb2Fragments, {[bidder]: ortb2Conf}); @@ -254,7 +254,7 @@ export function getSegAndCatsArray(data, minScore, pid) { return sirdataData; } -export function applySdaGetSpecificData(data, sirdataList, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit) { +export function applySdaGetSpecificData(data, sirdataData, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit) { // only share SDA data if whitelisted if (!biddersParamsExist || indexFound) { // SDA Publisher @@ -269,7 +269,8 @@ export function applySdaGetSpecificData(data, sirdataList, biddersParamsExist, m if (data.shared_taxonomy && data.shared_taxonomy[curationId]) { // Get Bidder Specific Data let curationData = getSegAndCatsArray(data.shared_taxonomy[curationId], minScore, null); - sirdataList = sirdataList.concat(curationData.segments).concat(curationData.categories); + sirdataData.segments = sirdataData.segments.concat(curationData.segments); + sirdataData.categories = sirdataData.categories.concat(curationData.categories); // SDA Partners let curationDataForSDA = getSegAndCatsArray(data.shared_taxonomy[curationId], minScore, curationId); @@ -278,19 +279,22 @@ export function applySdaGetSpecificData(data, sirdataList, biddersParamsExist, m } // Apply custom function or return Bidder Specific Data if publisher is ok - if (sirdataList && sirdataList.length > 0 && (!biddersParamsExist || indexFound)) { + if (!biddersParamsExist || indexFound) { if (indexFound && moduleConfig.params.bidders[bidderIndex].hasOwnProperty('customFunction')) { - return loadCustomFunction(moduleConfig.params.bidders[bidderIndex].customFunction, adUnit, sirdataList, data, bid); + return loadCustomFunction(moduleConfig.params.bidders[bidderIndex].customFunction, adUnit, sirdataData, data, bid); } else { - return sirdataList; + return sirdataData; } } } -export function applySdaAndDefaultSpecificData(data, sirdataList, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit) { - let specificData = applySdaGetSpecificData(data, sirdataList, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); - if (specificData && specificData.length > 0) { - setBidderOrtb2(reqBids.ortb2Fragments?.bidder, bid.bidder, 'user.ext.data', {sd_rtd: specificData}); +export function applySdaAndDefaultSpecificData(data, sirdataData, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit) { + sirdataData = applySdaGetSpecificData(data, sirdataData, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); + if (sirdataData.segments && sirdataData.segments.length > 0) { + setBidderOrtb2(reqBids.ortb2Fragments?.bidder, bid.bidder, 'user.ext.data', {sd_rtd: sirdataData.segments}); + } + if (sirdataData.categories && sirdataData.categories.length > 0) { + setBidderOrtb2(reqBids.ortb2Fragments?.bidder, bid.bidder, 'site.ext.data', {sd_rtd: sirdataData.categories}); } } @@ -301,8 +305,6 @@ export function addSegmentData(reqBids, data, moduleConfig, onDone) { const globalMinScore = moduleConfig.params.hasOwnProperty('contextualMinRelevancyScore') ? moduleConfig.params.contextualMinRelevancyScore : 30; var sirdataData = getSegAndCatsArray(data, globalMinScore, null); - const sirdataList = sirdataData.segments.concat(sirdataData.categories); - const biddersParamsExist = (!!(moduleConfig.params && moduleConfig.params.bidders)); // Global ortb2 SDA @@ -320,15 +322,17 @@ export function addSegmentData(reqBids, data, moduleConfig, onDone) { if (typeof window.googletag !== 'undefined' && (moduleConfig.params.setGptKeyValues || !moduleConfig.params.hasOwnProperty('setGptKeyValues'))) { try { let gptCurationId = (moduleConfig.params.gptCurationId ? moduleConfig.params.gptCurationId : (partnerIds['sdRtdForGpt'] ? partnerIds['sdRtdForGpt'] : null)); - let sirdataMergedList = sirdataList; + let sirdataMergedList = sirdataData.segments.concat(sirdataData.categories); if (gptCurationId && data.shared_taxonomy && data.shared_taxonomy[gptCurationId]) { let gamCurationData = getSegAndCatsArray(data.shared_taxonomy[gptCurationId], globalMinScore, null); sirdataMergedList = sirdataMergedList.concat(gamCurationData.segments).concat(gamCurationData.categories); } - window.googletag.pubads().getSlots().forEach(function (n) { - if (typeof n.setTargeting !== 'undefined' && sirdataMergedList && sirdataMergedList.length > 0) { - n.setTargeting('sd_rtd', sirdataMergedList); - } + window.googletag.cmd.push(function() { + window.googletag.pubads().getSlots().forEach(function (n) { + if (typeof n.setTargeting !== 'undefined' && sirdataMergedList && sirdataMergedList.length > 0) { + n.setTargeting('sd_rtd', sirdataMergedList); + } + }); }); } catch (e) { logError(e); @@ -340,10 +344,6 @@ export function addSegmentData(reqBids, data, moduleConfig, onDone) { var indexFound = false; adUnits.forEach(adUnit => { - if (!biddersParamsExist && !deepAccess(adUnit, 'ortb2Imp.ext.data.sd_rtd')) { - deepSetValue(adUnit, 'ortb2Imp.ext.data.sd_rtd', sirdataList); - } - adUnit.hasOwnProperty('bids') && adUnit.bids.forEach(bid => { bidderIndex = (moduleConfig.params.hasOwnProperty('bidders') ? findIndex(moduleConfig.params.bidders, function (i) { return i.bidder === bid.bidder; @@ -351,7 +351,6 @@ export function addSegmentData(reqBids, data, moduleConfig, onDone) { indexFound = (!!(typeof bidderIndex == 'number' && bidderIndex >= 0)); try { let minScore = (indexFound && moduleConfig.params.bidders[bidderIndex].hasOwnProperty('contextualMinRelevancyScore') ? moduleConfig.params.bidders[bidderIndex].contextualMinRelevancyScore : globalMinScore); - let specificData = null; switch (bid.bidder) { case 'appnexus': @@ -370,57 +369,24 @@ export function addSegmentData(reqBids, data, moduleConfig, onDone) { case 'msq_classic': case 'msq_max': case '366_apx': - specificData = applySdaGetSpecificData(data, sirdataList, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); - if (specificData && specificData.length > 0) { - deepSetValue(bid, 'params.keywords.sd_rtd', specificData); + sirdataData = applySdaGetSpecificData(data, sirdataData, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); + if (sirdataData.segments && sirdataData.segments.length > 0) { + setBidderOrtb2(reqBids.ortb2Fragments?.bidder, bid.bidder, 'user.keywords', 'sd_rtd=' + sirdataData.segments.join(',sd_rtd=')); } - break; - - case 'smartadserver': - case 'smart': - specificData = applySdaGetSpecificData(data, sirdataList, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); - if (specificData && specificData.length > 0) { - var target = []; - if (bid.hasOwnProperty('params') && bid.params.hasOwnProperty('target')) { - target.push(bid.params.target); - } - specificData.forEach(function (entry) { - if (target.indexOf('sd_rtd=' + entry) === -1) { - target.push('sd_rtd=' + entry); - } - }); - deepSetValue(bid, 'params.target', target.join(';')); - } - break; - - case 'ix': - specificData = applySdaGetSpecificData(data, sirdataList, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); - let ixConfig = config.getConfig('ix.firstPartyData.sd_rtd'); - if (!ixConfig && specificData && specificData.length > 0) { - let cappIxCategories = []; - let ixLength = 0; - let ixLimit = (indexFound && moduleConfig.params.bidders[bidderIndex].hasOwnProperty('sizeLimit') ? moduleConfig.params.bidders[bidderIndex].sizeLimit : 1000); - // Push ids For publisher use and for curation if exists but limit size because the bidder uses GET parameters - specificData.forEach(function (entry) { - if (ixLength < ixLimit) { - cappIxCategories.push(entry); - ixLength += entry.toString().length; - } - }); - config.setConfig({ix: {firstPartyData: {sd_rtd: cappIxCategories}}}); + if (sirdataData.categories && sirdataData.categories.length > 0) { + setBidderOrtb2(reqBids.ortb2Fragments?.bidder, bid.bidder, 'site.content.keywords', 'sd_rtd=' + sirdataData.categories.join(',sd_rtd=')); } break; case 'proxistore': - specificData = applySdaGetSpecificData(data, sirdataList, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); - if (specificData && specificData.length > 0) { - let psCurationId = (indexFound && moduleConfig.params.bidders[bidderIndex].hasOwnProperty('curationId') ? moduleConfig.params.bidders[bidderIndex].curationId : (partnerIds[bid.bidder] ? partnerIds[bid.bidder] : null)); - if (!data.shared_taxonomy || !data.shared_taxonomy[psCurationId]) { - data.shared_taxonomy[psCurationId] = {segments: [], contextual_categories: {}, segtaxid: null, cattaxid: null}; - } - let psCurationData = getSegAndCatsArray(data.shared_taxonomy[psCurationId], minScore, null); + sirdataData = applySdaGetSpecificData(data, sirdataData, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); + let psCurationId = (indexFound && moduleConfig.params.bidders[bidderIndex].hasOwnProperty('curationId') ? moduleConfig.params.bidders[bidderIndex].curationId : (partnerIds[bid.bidder] ? partnerIds[bid.bidder] : null)); + if (!data.shared_taxonomy || !data.shared_taxonomy[psCurationId]) { + data.shared_taxonomy[psCurationId] = {segments: [], contextual_categories: {}, segtaxid: null, cattaxid: null}; + } + if ((sirdataData.segments && sirdataData.segments.length > 0) || (sirdataData.categories && sirdataData.categories.length > 0)) { setBidderOrtb2(reqBids.ortb2Fragments?.bidder, bid.bidder, 'user.ext.data', { - segments: sirdataData.segments.concat(psCurationData.segments), + segments: sirdataData.segments, contextual_categories: {...data.contextual_categories, ...data.shared_taxonomy[psCurationId].contextual_categories} }); } @@ -445,12 +411,15 @@ export function addSegmentData(reqBids, data, moduleConfig, onDone) { case 'sublime': case 'rtbhouse': case 'mediasquare': - applySdaAndDefaultSpecificData(data, sirdataList, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); + case 'smartadserver': + case 'smart': + case 'ix': + applySdaAndDefaultSpecificData(data, sirdataData, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); break; default: if (!biddersParamsExist || (indexFound && (!moduleConfig.params.bidders[bidderIndex].hasOwnProperty('adUnitCodes') || moduleConfig.params.bidders[bidderIndex].adUnitCodes.indexOf(adUnit.code) !== -1))) { - applySdaAndDefaultSpecificData(data, sirdataList, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); + applySdaAndDefaultSpecificData(data, sirdataData, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); } } } catch (e) { diff --git a/test/spec/modules/sirdataRtdProvider_spec.js b/test/spec/modules/sirdataRtdProvider_spec.js index eccc4777906..f4244fc8414 100644 --- a/test/spec/modules/sirdataRtdProvider_spec.js +++ b/test/spec/modules/sirdataRtdProvider_spec.js @@ -1,26 +1,31 @@ -import {addSegmentData, getSegmentsAndCategories, sirdataSubmodule} from 'modules/sirdataRtdProvider.js'; +import {addSegmentData, getSegmentsAndCategories, sirdataSubmodule, setBidderOrtb2} from 'modules/sirdataRtdProvider.js'; import {server} from 'test/mocks/xhr.js'; const responseHeader = {'Content-Type': 'application/json'}; describe('sirdataRtdProvider', function () { describe('sirdataSubmodule', function () { + it('exists', function () { + expect(sirdataSubmodule.init).to.be.a('function'); + }); it('successfully instantiates', function () { expect(sirdataSubmodule.init()).to.equal(true); }); + it('has the correct module name', function () { + expect(sirdataSubmodule.name).to.equal('SirdataRTDModule'); + }); }); describe('Add Segment Data', function () { it('adds segment data', function () { - const config = { + const firstConfig = { params: { - setGptKeyValues: false, + partnerId: 1, + key: 1, + setGptKeyValues: true, + gptCurationId: 27449, contextualMinRelevancyScore: 50, - bidders: [{ - bidder: 'appnexus' - }, { - bidder: 'other' - }] + bidders: [] } }; @@ -37,21 +42,47 @@ describe('sirdataRtdProvider', function () { } ]; - let data = { + let firstReqBidsConfigObj = { + adUnits: adUnits, + ortb2Fragments: { + global: {} + } + }; + + let firstData = { segments: [111111, 222222], - contextual_categories: {'333333': 100} + contextual_categories: {'333333': 100}, + 'segtaxid': null, + 'cattaxid': null, + 'shared_taxonomy': { + '27449': { + 'segments': [444444, 555555], + 'segtaxid': null, + 'cattaxid': null, + 'contextual_categories': {'666666': 100} + } + }, + 'global_taxonomy': { + '9998': { + 'segments': [123, 234], + 'segtaxid': 4, + 'cattaxid': 7, + 'contextual_categories': {'345': 100, '456': 100} + } + } }; - addSegmentData({adUnits}, data, config, () => { + addSegmentData(firstReqBidsConfigObj, firstData, firstConfig, () => { }); - expect(adUnits[0].bids[0].params.keywords).to.have.deep.property('sd_rtd', ['111111', '222222', '333333']); + + expect(firstReqBidsConfigObj.ortb2Fragments.global.user.data[0].ext.segtax).to.equal(4); }); }); describe('Get Segments And Categories', function () { it('gets data from async request and adds segment data', function () { const overrideAppnexus = function (adUnit, list, data, bid) { - deepSetValue(bid, 'params.keywords.custom', list); + deepSetValue(bid, 'params.keywords.custom', list.segments.concat(list.categories)); } const config = { @@ -60,16 +91,21 @@ describe('sirdataRtdProvider', function () { contextualMinRelevancyScore: 50, bidders: [{ bidder: 'appnexus', - customFunction: overrideAppnexus + customFunction: overrideAppnexus, + curationId: 27446 }, { - bidder: 'smartadserver' + bidder: 'smartadserver', + curationId: 27440 }, { bidder: 'ix', sizeLimit: 1200, + curationId: 27248 }, { bidder: 'rubicon', + curationId: 27452 }, { bidder: 'proxistore', + curationId: 27484 }] } }; @@ -146,6 +182,12 @@ describe('sirdataRtdProvider', function () { 'segtaxid': 552, 'cattaxid': 553, 'contextual_categories': {'666666': 100} + }, + '27446': { + 'segments': [777777, 888888], + 'segtaxid': 552, + 'cattaxid': 553, + 'contextual_categories': {'999999': 100} } }, 'global_taxonomy': { @@ -164,8 +206,6 @@ describe('sirdataRtdProvider', function () { let request = server.requests[0]; request.respond(200, responseHeader, JSON.stringify(data)); - expect(reqBidsConfigObj.adUnits[0].bids[1].params).to.have.deep.property('target', 'sd_rtd=111111;sd_rtd=222222;sd_rtd=333333;sd_rtd=444444;sd_rtd=555555;sd_rtd=666666'); - expect(reqBidsConfigObj.ortb2Fragments.global.site.content.data[0].name).to.equal( 'sirdata.com' ); @@ -185,4 +225,57 @@ describe('sirdataRtdProvider', function () { expect(reqBidsConfigObj.ortb2Fragments.global.user.data[0].ext.segtax).to.equal(4); }); }); + + describe('Set ortb2 for bidder', function () { + it('set ortb2 for a givent bidder', function () { + const config = { + params: { + setGptKeyValues: false, + contextualMinRelevancyScore: 50, + bidders: [{ + bidder: 'appnexus', + }] + } + }; + + let reqBidsConfigObj = { + adUnits: [{ + bids: [{ + bidder: 'appnexus', + params: { + placementId: 13144370 + } + }] + }], + ortb2Fragments: { + global: {} + } + }; + + let data = { + 'segments': [111111, 222222], + 'segtaxid': null, + 'cattaxid': null, + 'contextual_categories': {'333333': 100}, + 'shared_taxonomy': { + '27440': { + 'segments': [444444, 555555], + 'segtaxid': null, + 'cattaxid': null, + 'contextual_categories': {'666666': 100} + } + }, + 'global_taxonomy': {} + }; + + window.googletag = window.googletag || {}; + window.googletag.cmd = window.googletag.cmd || []; + + let test = setBidderOrtb2(reqBidsConfigObj.ortb2Fragments, 'appnexus', 'user', []); + expect(test).to.be.false; + + test = setBidderOrtb2(reqBidsConfigObj.ortb2Fragments, 'appnexus', 'user', ['1']); + expect(test).to.be.true; + }); + }); }); From af02777683917f7e3d8e7d4020bc968447543354 Mon Sep 17 00:00:00 2001 From: Bob Date: Fri, 2 Jun 2023 14:02:02 +0200 Subject: [PATCH 4/4] bidder specific handling removal move Proxistore spcific logic to bidder --- modules/proxistoreBidAdapter.js | 25 ++-- modules/sirdataRtdProvider.js | 146 +++++++------------ test/spec/modules/sirdataRtdProvider_spec.js | 6 +- 3 files changed, 66 insertions(+), 111 deletions(-) diff --git a/modules/proxistoreBidAdapter.js b/modules/proxistoreBidAdapter.js index 1f113f9c432..2b5e31d535d 100644 --- a/modules/proxistoreBidAdapter.js +++ b/modules/proxistoreBidAdapter.js @@ -88,23 +88,20 @@ function _createServerRequest(bidRequests, bidderRequest) { } function _assignSegments(bid) { - if ( - bid.ortb2 && - bid.ortb2.user && - bid.ortb2.user.ext && - bid.ortb2.user.ext.data - ) { - return ( - bid.ortb2.user.ext.data || { - segments: [], - contextual_categories: {}, - } - ); + var segs = (bid.ortb2 && bid.ortb2.user && bid.ortb2.user.ext && bid.ortb2.user.ext.data && bid.ortb2.user.ext.data.sd_rtd && bid.ortb2.user.ext.data.sd_rtd.segments ? bid.ortb2.user.ext.data.sd_rtd.segments : []); + var cats = {}; + if (bid.ortb2 && bid.ortb2.site && bid.ortb2.site.ext && bid.ortb2.site.ext.data && bid.ortb2.site.ext.data.sd_rtd) { + if (bid.ortb2.site.ext.data.sd_rtd.categories) { + segs = segs.concat(bid.ortb2.site.ext.data.sd_rtd.categories); + } + if (bid.ortb2.site.ext.data.sd_rtd.categories_score) { + cats = bid.ortb2.site.ext.data.sd_rtd.categories_score; + } } return { - segments: [], - contextual_categories: {}, + segments: segs, + contextual_categories: cats }; } diff --git a/modules/sirdataRtdProvider.js b/modules/sirdataRtdProvider.js index df2359a13b3..aaa3c48856b 100644 --- a/modules/sirdataRtdProvider.js +++ b/modules/sirdataRtdProvider.js @@ -134,44 +134,24 @@ export function getSegmentsAndCategories(reqBidsConfigObj, onDone, moduleConfig, }); } -export function setGlobalOrtb2Sda(ortb2Fragments, data, segtaxid, cattaxid) { +export function pushToOrtb2(ortb2Fragments, bidder, data, segtaxid, cattaxid) { try { if (!isEmpty(data.segments)) { - applyGlobalOrtb2Sda(ortb2Fragments, 'user', data.segments, segtaxid); + if (segtaxid) { + setOrtb2Sda(ortb2Fragments, bidder, 'user', data.segments, segtaxid); + } else { + setOrtb2(ortb2Fragments, bidder, 'user.ext.data', {sd_rtd: {segments: data.segments}}); + } } if (!isEmpty(data.categories)) { - applyGlobalOrtb2Sda(ortb2Fragments, 'site', data.categories, cattaxid); - } - } catch (e) { - logError(e) - } - return true; -} - -export function applyGlobalOrtb2Sda(ortb2Fragments, type, segments, segtaxValue) { - try { - let ortb2Data = [{ - name: ORTB2_NAME, - segment: segments.map((segmentId) => ({ id: segmentId })), - }]; - if (segtaxValue) { - ortb2Data[0].ext = { segtax: segtaxValue }; - } - let ortb2Conf = (type == 'site' ? {site: {content: {data: ortb2Data}}} : {user: {data: ortb2Data}}); - mergeDeep(ortb2Fragments, ortb2Conf); - } catch (e) { - logError(e) - } - return true; -} - -export function setBidderOrtb2Sda(ortb2Fragments, bidder, data, segtaxid, cattaxid) { - try { - if (!isEmpty(data.segments)) { - applyBidderOrtb2Sda(ortb2Fragments, bidder, 'user', data.segments, segtaxid); + if (cattaxid) { + setOrtb2Sda(ortb2Fragments, bidder, 'site', data.categories, cattaxid); + } else { + setOrtb2(ortb2Fragments, bidder, 'site.ext.data', {sd_rtd: {categories: data.categories}}); + } } - if (!isEmpty(data.categories)) { - applyBidderOrtb2Sda(ortb2Fragments, bidder, 'site', data.categories, cattaxid); + if (!isEmpty(data.categories_score) && !cattaxid) { + setOrtb2(ortb2Fragments, bidder, 'site.ext.data', {sd_rtd: {categories_score: data.categories_score}}); } } catch (e) { logError(e) @@ -179,7 +159,7 @@ export function setBidderOrtb2Sda(ortb2Fragments, bidder, data, segtaxid, cattax return true; } -export function applyBidderOrtb2Sda(ortb2Fragments, bidder, type, segments, segtaxValue) { +export function setOrtb2Sda(ortb2Fragments, bidder, type, segments, segtaxValue) { try { let ortb2Data = [{ name: ORTB2_NAME, @@ -189,19 +169,25 @@ export function applyBidderOrtb2Sda(ortb2Fragments, bidder, type, segments, segt ortb2Data[0].ext = { segtax: segtaxValue }; } let ortb2Conf = (type == 'site' ? {site: {content: {data: ortb2Data}}} : {user: {data: ortb2Data}}); - mergeDeep(ortb2Fragments, {[bidder]: ortb2Conf}); + if (bidder) { + ortb2Conf = {[bidder]: ortb2Conf}; + } + mergeDeep(ortb2Fragments, ortb2Conf); } catch (e) { logError(e) } return true; } -export function setBidderOrtb2(bidderOrtb2Fragments, bidder, path, segments) { +export function setOrtb2(ortb2Fragments, bidder, path, segments) { try { if (isEmpty(segments)) { return false; } let ortb2Conf = {}; deepSetValue(ortb2Conf, path, segments || {}); - mergeDeep(bidderOrtb2Fragments, {[bidder]: ortb2Conf}); + if (bidder) { + ortb2Conf = {[bidder]: ortb2Conf}; + } + mergeDeep(ortb2Fragments, ortb2Conf); } catch (e) { logError(e) } @@ -221,15 +207,22 @@ export function loadCustomFunction(todo, adUnit, list, data, bid) { } export function getSegAndCatsArray(data, minScore, pid) { - let sirdataData = {'segments': [], 'categories': []}; + let sirdataData = {'segments': [], 'categories': [], 'categories_score': {}}; minScore = minScore && typeof minScore == 'number' ? minScore : 30; + let cattaxid = data.cattaxid || null; + let segtaxid = data.segtaxid || null; try { if (data && data.contextual_categories) { for (let catId in data.contextual_categories) { if (data.contextual_categories.hasOwnProperty(catId) && data.contextual_categories[catId]) { let value = data.contextual_categories[catId]; if (value >= minScore && sirdataData.categories.indexOf(catId) === -1) { - sirdataData.categories.push((pid ? pid.toString() + 'cc' : '') + catId.toString()); + if (pid && cattaxid) { + sirdataData.categories.push(pid.toString() + 'cc' + catId.toString()); + } else { + sirdataData.categories.push(catId.toString()); + sirdataData.categories_score[catId] = value; + } } } } @@ -241,9 +234,16 @@ export function getSegAndCatsArray(data, minScore, pid) { if (data && data.segments) { for (let segId in data.segments) { if (data.segments.hasOwnProperty(segId) && data.segments[segId]) { - sirdataData.segments.push((pid ? pid.toString() + 'us' : '') + data.segments[segId].toString()); + let id = data.segments[segId].toString(); if (pid && CONTEXT_ONLY) { - sirdataData.categories.push(pid.toString() + 'uc' + data.segments[segId].toString()); + if (segtaxid) { + sirdataData.categories.push(pid.toString() + 'uc' + id); + } else { + sirdataData.categories.push(id); + sirdataData.categories_score[id] = 100; + } + } else { + sirdataData.segments.push((pid && segtaxid) ? pid.toString() + 'us' + id : id); } } } @@ -259,7 +259,7 @@ export function applySdaGetSpecificData(data, sirdataData, biddersParamsExist, m if (!biddersParamsExist || indexFound) { // SDA Publisher let sirdataDataForSDA = getSegAndCatsArray(data, minScore, moduleConfig.params.partnerId); - setBidderOrtb2Sda(reqBids.ortb2Fragments?.bidder, bid.bidder, sirdataDataForSDA, data.segtaxid, data.cattaxid); + pushToOrtb2(reqBids.ortb2Fragments?.bidder, bid.bidder, sirdataDataForSDA, data.segtaxid, data.cattaxid); } // always share SDA for curation @@ -268,13 +268,8 @@ export function applySdaGetSpecificData(data, sirdataData, biddersParamsExist, m // seller defined audience & bidder specific data if (data.shared_taxonomy && data.shared_taxonomy[curationId]) { // Get Bidder Specific Data - let curationData = getSegAndCatsArray(data.shared_taxonomy[curationId], minScore, null); - sirdataData.segments = sirdataData.segments.concat(curationData.segments); - sirdataData.categories = sirdataData.categories.concat(curationData.categories); - - // SDA Partners - let curationDataForSDA = getSegAndCatsArray(data.shared_taxonomy[curationId], minScore, curationId); - setBidderOrtb2Sda(reqBids.ortb2Fragments?.bidder, bid.bidder, curationDataForSDA, data.shared_taxonomy[curationId].segtaxid, data.shared_taxonomy[curationId].cattaxid); + let curationData = getSegAndCatsArray(data.shared_taxonomy[curationId], minScore, curationId); + pushToOrtb2(reqBids.ortb2Fragments?.bidder, bid.bidder, curationData, data.shared_taxonomy[curationId].segtaxid, data.shared_taxonomy[curationId].cattaxid); } } @@ -290,12 +285,14 @@ export function applySdaGetSpecificData(data, sirdataData, biddersParamsExist, m export function applySdaAndDefaultSpecificData(data, sirdataData, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit) { sirdataData = applySdaGetSpecificData(data, sirdataData, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); + /* if (sirdataData.segments && sirdataData.segments.length > 0) { - setBidderOrtb2(reqBids.ortb2Fragments?.bidder, bid.bidder, 'user.ext.data', {sd_rtd: sirdataData.segments}); + setOrtb2(reqBids.ortb2Fragments?.bidder, bid.bidder, 'user.ext.data', {sd_rtd: sirdataData.segments}); } if (sirdataData.categories && sirdataData.categories.length > 0) { - setBidderOrtb2(reqBids.ortb2Fragments?.bidder, bid.bidder, 'site.ext.data', {sd_rtd: sirdataData.categories}); + setOrtb2(reqBids.ortb2Fragments?.bidder, bid.bidder, 'site.ext.data', {sd_rtd: sirdataData.categories}); } + */ } export function addSegmentData(reqBids, data, moduleConfig, onDone) { @@ -309,11 +306,11 @@ export function addSegmentData(reqBids, data, moduleConfig, onDone) { // Global ortb2 SDA if (data.global_taxonomy && !isEmpty(data.global_taxonomy)) { - let globalData = {'segments': [], 'categories': []}; + let globalData = {'segments': [], 'categories': [], 'categories_score': []}; for (let i in data.global_taxonomy) { if (!isEmpty(data.global_taxonomy[i])) { globalData = getSegAndCatsArray(data.global_taxonomy[i], globalMinScore, null); - setGlobalOrtb2Sda(reqBids.ortb2Fragments?.global, globalData, data.global_taxonomy[i].segtaxid, data.global_taxonomy[i].cattaxid); + pushToOrtb2(reqBids.ortb2Fragments?.global, null, globalData, data.global_taxonomy[i].segtaxid, data.global_taxonomy[i].cattaxid); } } } @@ -371,52 +368,13 @@ export function addSegmentData(reqBids, data, moduleConfig, onDone) { case '366_apx': sirdataData = applySdaGetSpecificData(data, sirdataData, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); if (sirdataData.segments && sirdataData.segments.length > 0) { - setBidderOrtb2(reqBids.ortb2Fragments?.bidder, bid.bidder, 'user.keywords', 'sd_rtd=' + sirdataData.segments.join(',sd_rtd=')); + setOrtb2(reqBids.ortb2Fragments?.bidder, bid.bidder, 'user.keywords', 'sd_rtd=' + sirdataData.segments.join(',sd_rtd=')); } if (sirdataData.categories && sirdataData.categories.length > 0) { - setBidderOrtb2(reqBids.ortb2Fragments?.bidder, bid.bidder, 'site.content.keywords', 'sd_rtd=' + sirdataData.categories.join(',sd_rtd=')); + setOrtb2(reqBids.ortb2Fragments?.bidder, bid.bidder, 'site.content.keywords', 'sd_rtd=' + sirdataData.categories.join(',sd_rtd=')); } break; - case 'proxistore': - sirdataData = applySdaGetSpecificData(data, sirdataData, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); - let psCurationId = (indexFound && moduleConfig.params.bidders[bidderIndex].hasOwnProperty('curationId') ? moduleConfig.params.bidders[bidderIndex].curationId : (partnerIds[bid.bidder] ? partnerIds[bid.bidder] : null)); - if (!data.shared_taxonomy || !data.shared_taxonomy[psCurationId]) { - data.shared_taxonomy[psCurationId] = {segments: [], contextual_categories: {}, segtaxid: null, cattaxid: null}; - } - if ((sirdataData.segments && sirdataData.segments.length > 0) || (sirdataData.categories && sirdataData.categories.length > 0)) { - setBidderOrtb2(reqBids.ortb2Fragments?.bidder, bid.bidder, 'user.ext.data', { - segments: sirdataData.segments, - contextual_categories: {...data.contextual_categories, ...data.shared_taxonomy[psCurationId].contextual_categories} - }); - } - break; - - case 'rubicon': - case 'criteo': - case 'triplelift': - case 'smaato': - case 'yahoossp': - case 'openx': - case 'pubmatic': - case 'smilewanted': - case 'taboola': - case 'ttd': - case 'zeta_global': - case 'zeta_global_ssp': - case 'teads': - case 'conversant': - case 'improvedigital': - case 'invibes': - case 'sublime': - case 'rtbhouse': - case 'mediasquare': - case 'smartadserver': - case 'smart': - case 'ix': - applySdaAndDefaultSpecificData(data, sirdataData, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); - break; - default: if (!biddersParamsExist || (indexFound && (!moduleConfig.params.bidders[bidderIndex].hasOwnProperty('adUnitCodes') || moduleConfig.params.bidders[bidderIndex].adUnitCodes.indexOf(adUnit.code) !== -1))) { applySdaAndDefaultSpecificData(data, sirdataData, biddersParamsExist, minScore, reqBids, bid, moduleConfig, indexFound, bidderIndex, adUnit); diff --git a/test/spec/modules/sirdataRtdProvider_spec.js b/test/spec/modules/sirdataRtdProvider_spec.js index f4244fc8414..fbb5967bc20 100644 --- a/test/spec/modules/sirdataRtdProvider_spec.js +++ b/test/spec/modules/sirdataRtdProvider_spec.js @@ -1,4 +1,4 @@ -import {addSegmentData, getSegmentsAndCategories, sirdataSubmodule, setBidderOrtb2} from 'modules/sirdataRtdProvider.js'; +import {addSegmentData, getSegmentsAndCategories, sirdataSubmodule, setOrtb2} from 'modules/sirdataRtdProvider.js'; import {server} from 'test/mocks/xhr.js'; const responseHeader = {'Content-Type': 'application/json'}; @@ -271,10 +271,10 @@ describe('sirdataRtdProvider', function () { window.googletag = window.googletag || {}; window.googletag.cmd = window.googletag.cmd || []; - let test = setBidderOrtb2(reqBidsConfigObj.ortb2Fragments, 'appnexus', 'user', []); + let test = setOrtb2(reqBidsConfigObj.ortb2Fragments, 'appnexus', 'user', []); expect(test).to.be.false; - test = setBidderOrtb2(reqBidsConfigObj.ortb2Fragments, 'appnexus', 'user', ['1']); + test = setOrtb2(reqBidsConfigObj.ortb2Fragments, 'appnexus', 'user', ['1']); expect(test).to.be.true; }); });