From 642803b541e19a145c2c93ec6a716d9ae86bde71 Mon Sep 17 00:00:00 2001 From: Renee Woo Date: Tue, 1 Jun 2021 14:10:44 +0800 Subject: [PATCH 1/9] Adapter does not seem capable of supporting advertiserDomains #6650 added response comment and some trivial code. --- modules/jixieBidAdapter.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/modules/jixieBidAdapter.js b/modules/jixieBidAdapter.js index 7c6e0027482..798e84036db 100644 --- a/modules/jixieBidAdapter.js +++ b/modules/jixieBidAdapter.js @@ -240,6 +240,16 @@ export const spec = { let rendererScript = (oneBid.osparams.script ? oneBid.osparams.script : JX_OUTSTREAM_RENDERER_URL); bnd.renderer = createRenderer_(oneBid, rendererScript, jxOutstreamRender_); } + //a note on advertiserDomains: our adserver is not responding in + //openRTB-type json. so there is no need to copy from 'adomain' over + //to meta: advertiserDomains + //However, we will just make sure the property is there. + if (!bnd.meta) { + bnd.meta = {}; + } + if (!bnd.meta.advertiserDomains) { + bnd.meta.advertiserDomains = []; + } bidResponses.push(bnd); }); if (response.body.setids) { @@ -252,3 +262,4 @@ export const spec = { } registerBidder(spec); + From 103b8ae889047d710a21f84e1cfc675a8879e9d7 Mon Sep 17 00:00:00 2001 From: Renee Woo Date: Tue, 1 Jun 2021 14:24:20 +0800 Subject: [PATCH 2/9] removed a blank line at the end of file added a space behind the // in comments --- modules/jixieBidAdapter.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/modules/jixieBidAdapter.js b/modules/jixieBidAdapter.js index 798e84036db..db6c9032e65 100644 --- a/modules/jixieBidAdapter.js +++ b/modules/jixieBidAdapter.js @@ -240,10 +240,10 @@ export const spec = { let rendererScript = (oneBid.osparams.script ? oneBid.osparams.script : JX_OUTSTREAM_RENDERER_URL); bnd.renderer = createRenderer_(oneBid, rendererScript, jxOutstreamRender_); } - //a note on advertiserDomains: our adserver is not responding in - //openRTB-type json. so there is no need to copy from 'adomain' over - //to meta: advertiserDomains - //However, we will just make sure the property is there. + // a note on advertiserDomains: our adserver is not responding in + // openRTB-type json. so there is no need to copy from 'adomain' over + // to meta: advertiserDomains + // However, we will just make sure the property is there. if (!bnd.meta) { bnd.meta = {}; } @@ -262,4 +262,3 @@ export const spec = { } registerBidder(spec); - From 704e9747bd9765250c4756e198e7ebde34cc9a0d Mon Sep 17 00:00:00 2001 From: Renee Woo Date: Wed, 2 Jun 2021 12:34:53 +0800 Subject: [PATCH 3/9] in response to comment from reviewer. add the aspect of advertiserdomain in unit tests --- test/spec/modules/jixieBidAdapter_spec.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/spec/modules/jixieBidAdapter_spec.js b/test/spec/modules/jixieBidAdapter_spec.js index 842f9e0ed30..ae58da30f64 100644 --- a/test/spec/modules/jixieBidAdapter_spec.js +++ b/test/spec/modules/jixieBidAdapter_spec.js @@ -281,7 +281,8 @@ describe('jixie Adapter', function () { }, 'vastUrl': 'https://ad.jixie.io/v1/video?creativeid=522' }, - // display ad returned here: + // display ad returned here: This one there is advertiserDomains + // in the response . Will be checked in the unit tests below { 'trackingUrlBase': 'https://tr.jixie.io/sync/ad?', 'jxBidId': '600c9ae6fda1acb-028d5dee-2c83-44e3-bed1-b75002475cdf', @@ -411,6 +412,9 @@ describe('jixie Adapter', function () { expect(result[0].ttl).to.equal(300) expect(result[0].vastUrl).to.include('https://ad.jixie.io/v1/video?creativeid=') expect(result[0].trackingUrlBase).to.include('sync') + // We will always make sure the meta->advertiserDomains property is there + // If no info it is an empty array. + expect(result[0].meta.advertiserDomains.length).to.equal(0) // display ad expect(result[1].requestId).to.equal('600c9ae6fda1acb') @@ -422,6 +426,7 @@ describe('jixie Adapter', function () { expect(result[1].netRevenue).to.equal(true) expect(result[1].ttl).to.equal(300) expect(result[1].ad).to.include('jxoutstream') + expect(result[1].meta.advertiserDomains.length).to.equal(3) expect(result[1].trackingUrlBase).to.include('sync') // should pick up about using alternative outstream renderer @@ -436,6 +441,7 @@ describe('jixie Adapter', function () { expect(result[2].vastXml).to.include('') expect(result[2].trackingUrlBase).to.include('sync'); expect(result[2].renderer.id).to.equal('demoslot4-div') + expect(result[2].meta.advertiserDomains.length).to.equal(0) expect(result[2].renderer.url).to.equal(JX_OTHER_OUTSTREAM_RENDERER_URL); // should know to use default outstream renderer @@ -450,6 +456,7 @@ describe('jixie Adapter', function () { expect(result[3].vastXml).to.include('') expect(result[3].trackingUrlBase).to.include('sync'); expect(result[3].renderer.id).to.equal('demoslot2-div') + expect(result[3].meta.advertiserDomains.length).to.equal(0) expect(result[3].renderer.url).to.equal(JX_OUTSTREAM_RENDERER_URL) setLocalStorageSpy.restore(); From 7886688cf56ffd23d05c1986f807c9da9a70c86d Mon Sep 17 00:00:00 2001 From: jxdeveloper1 Date: Mon, 18 Oct 2021 16:14:20 +0800 Subject: [PATCH 4/9] added the code to get the keywords from the meta tags if available. --- modules/jixieBidAdapter.js | 10 ++++++++-- test/spec/modules/jixieBidAdapter_spec.js | 24 ++++++++++++----------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/modules/jixieBidAdapter.js b/modules/jixieBidAdapter.js index 0e05616465a..119fcdf142b 100644 --- a/modules/jixieBidAdapter.js +++ b/modules/jixieBidAdapter.js @@ -10,7 +10,7 @@ export const storage = getStorageManager(); const BIDDER_CODE = 'jixie'; const EVENTS_URL = 'https://hbtra.jixie.io/sync/hb?'; -const JX_OUTSTREAM_RENDERER_URL = 'https://scripts.jixie.io/jxhboutstream.js'; +const JX_OUTSTREAM_RENDERER_URL = 'https://scripts.jixie.media/jxhbrenderer.1.1.min.js'; const REQUESTS_URL = 'https://hb.jixie.io/v2/hbpost'; const sidTTLMins_ = 30; @@ -104,7 +104,8 @@ function getMiscDims_() { let ret = { pageurl: '', domain: '', - device: 'unknown' + device: 'unknown', + mkeywords: '' } try { let refererInfo_ = getRefererInfo(); @@ -112,6 +113,10 @@ function getMiscDims_() { ret.pageurl = url_; ret.domain = parseUrl(url_).host; ret.device = getDevice_(); + let keywords = document.getElementsByTagName('meta')['keywords']; + if (keywords && keywords.content) { + ret.mkeywords = keywords.content; + } } catch (error) {} return ret; } @@ -167,6 +172,7 @@ export const spec = { device: miscDims.device, domain: miscDims.domain, pageurl: miscDims.pageurl, + mkeywords: miscDims.mkeywords, bids: bids, cfg: jixieCfgBlob }, ids); diff --git a/test/spec/modules/jixieBidAdapter_spec.js b/test/spec/modules/jixieBidAdapter_spec.js index ae58da30f64..68de5c7a8fd 100644 --- a/test/spec/modules/jixieBidAdapter_spec.js +++ b/test/spec/modules/jixieBidAdapter_spec.js @@ -9,6 +9,7 @@ describe('jixie Adapter', function () { const device_ = 'desktop'; const timeout_ = 1000; const currency_ = 'USD'; + const keywords_ = ''; /** * Basic @@ -212,7 +213,7 @@ describe('jixie Adapter', function () { ); let miscDimsStub = sinon.stub(jixieaux, 'getMiscDims'); miscDimsStub - .returns({ device: device_, pageurl: pageurl_, domain: domain_ }); + .returns({ device: device_, pageurl: pageurl_, domain: domain_, mkeywords: keywords_ }); // actual api call: const request = spec.buildRequests(bidRequests_, bidderRequest_); @@ -229,6 +230,7 @@ describe('jixie Adapter', function () { expect(payload).to.have.property('device', device_); expect(payload).to.have.property('domain', domain_); expect(payload).to.have.property('pageurl', pageurl_); + expect(payload).to.have.property('mkeywords', keywords_); expect(payload).to.have.property('timeout', timeout_); expect(payload).to.have.property('currency', currency_); expect(payload).to.have.property('bids').that.deep.equals(refBids_); @@ -243,15 +245,15 @@ describe('jixie Adapter', function () { /** * interpretResponse: */ - const JX_OTHER_OUTSTREAM_RENDERER_URL = 'https://scripts.jixie.io/dummyscript.js'; - const JX_OUTSTREAM_RENDERER_URL = 'https://scripts.jixie.io/jxhboutstream.js'; + const JX_OTHER_OUTSTREAM_RENDERER_URL = 'https://scripts.jixie.media/dummyscript.js'; + const JX_OUTSTREAM_RENDERER_URL = 'https://scripts.jixie.media/jxhbrenderer.1.1.min.js'; - const mockVastXml_ = `JXADSERVERAlway%20Live%20Prebid%20CreativeHybrid in-stream00:00:10`; + const mockVastXml_ = `JXADSERVERAlway%20Live%20Prebid%20CreativeHybrid in-stream00:00:10`; const responseBody_ = { 'bids': [ // video (vast tag url) returned here { - 'trackingUrlBase': 'https://tr.jixie.io/sync/ad?', + 'trackingUrlBase': 'https://traid.jixie.io/sync/ad?', 'jxBidId': '62847e4c696edcb-028d5dee-2c83-44e3-bed1-b75002475cdf', 'requestId': '62847e4c696edcb', 'cpm': 2.19, @@ -284,7 +286,7 @@ describe('jixie Adapter', function () { // display ad returned here: This one there is advertiserDomains // in the response . Will be checked in the unit tests below { - 'trackingUrlBase': 'https://tr.jixie.io/sync/ad?', + 'trackingUrlBase': 'https://traid.jixie.io/sync/ad?', 'jxBidId': '600c9ae6fda1acb-028d5dee-2c83-44e3-bed1-b75002475cdf', 'requestId': '600c9ae6fda1acb', 'cpm': 1.999, @@ -317,11 +319,11 @@ describe('jixie Adapter', function () { ], 'mediaType': 'BANNER' }, - 'ad': '
' + 'ad': '
' }, // outstream, jx non-default renderer specified: { - 'trackingUrlBase': 'https://tr.jixie.io/sync/ad?', + 'trackingUrlBase': 'https://traid.jixie.io/sync/ad?', 'jxBidId': '99bc539c81b00ce-028d5dee-2c83-44e3-bed1-b75002475cdf', 'requestId': '99bc539c81b00ce', 'cpm': 2.99, @@ -340,7 +342,7 @@ describe('jixie Adapter', function () { }, // outstream, jx default renderer: { - 'trackingUrlBase': 'https://tr.jixie.io/sync/ad?', + 'trackingUrlBase': 'https://traid.jixie.io/sync/ad?', 'jxBidId': '61bc539c81b00ce-028d5dee-2c83-44e3-bed1-b75002475cdf', 'requestId': '61bc539c81b00ce', 'cpm': 1.99, @@ -475,7 +477,7 @@ describe('jixie Adapter', function () { ajaxStub = sinon.stub(jixieaux, 'ajax'); miscDimsStub - .returns({ device: device_, pageurl: pageurl_, domain: domain_ }); + .returns({ device: device_, pageurl: pageurl_, domain: domain_, mkeywords: keywords_ }); }) afterEach(function() { @@ -537,7 +539,7 @@ describe('jixie Adapter', function () { ajaxStub = sinon.stub(jixieaux, 'ajax'); miscDimsStub = sinon.stub(jixieaux, 'getMiscDims'); miscDimsStub - .returns({ device: device_, pageurl: pageurl_, domain: domain_ }); + .returns({ device: device_, pageurl: pageurl_, domain: domain_, mkeywords: keywords_ }); }) afterEach(function() { From 48076830ce736263f57514262b6fbada07309aba Mon Sep 17 00:00:00 2001 From: Renee Woo Date: Fri, 18 Aug 2023 16:59:16 +1000 Subject: [PATCH 5/9] WIP --- modules/jixieBidAdapter.js | 29 ++++++++++------------- test/spec/modules/jixieBidAdapter_spec.js | 15 ++++++++++++ 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/modules/jixieBidAdapter.js b/modules/jixieBidAdapter.js index b587011c748..9d62cb885ac 100644 --- a/modules/jixieBidAdapter.js +++ b/modules/jixieBidAdapter.js @@ -1,4 +1,4 @@ -import {deepAccess, getDNT, isArray, logWarn} from '../src/utils.js'; +import {deepAccess, isPlainObject, getDNT, isArray, logWarn} from '../src/utils.js'; import {config} from '../src/config.js'; import {registerBidder} from '../src/adapters/bidderFactory.js'; import {getStorageManager} from '../src/storageManager.js'; @@ -43,7 +43,8 @@ function fetchIds_() { client_id_c: '', client_id_ls: '', session_id_c: '', - session_id_ls: '' + session_id_ls: '', + jxeids : {} }; try { let tmp = storage.getCookie('_jxx'); @@ -55,6 +56,11 @@ function fetchIds_() { if (tmp) ret.client_id_ls = tmp; tmp = storage.getDataFromLocalStorage('_jxxs'); if (tmp) ret.session_id_ls = tmp; + //we have a problem if we + ['_jxtoko', '_jxifo', '_jxtdid', '__uid2_advertising_token'].forEach(function(n) { + tmp = storage.getCookie(n); + if (tmp) ret.jxeids[n] = tmp; + }); tmp = storage.getCookie('_jxtoko'); if (tmp) ret.jxtoko_id = tmp; } catch (error) {} @@ -132,17 +138,6 @@ function getMiscDims_() { return ret; } -/* function addUserId(eids, id, source, rti) { - if (id) { - if (rti) { - eids.push({ source, id, rti_partner: rti }); - } else { - eids.push({ source, id }); - } - } - return eids; -} */ - // easier for replacement in the unit test export const internal = { getDevice: getDevice_, @@ -170,13 +165,16 @@ export const spec = { let bids = []; validBidRequests.forEach(function(one) { - bids.push({ + let gpid = deepAccess(one, 'ortb2Imp.ext.gpid', deepAccess(one, 'ortb2Imp.ext.data.pbadslot', '')); + let tmp = { bidId: one.bidId, adUnitCode: one.adUnitCode, mediaTypes: (one.mediaTypes === 'undefined' ? {} : one.mediaTypes), sizes: (one.sizes === 'undefined' ? [] : one.sizes), params: one.params, - }); + gpid: gpid + }; + bids.push(tmp); }); let jixieCfgBlob = config.getConfig('jixie'); @@ -199,7 +197,6 @@ export const spec = { if (!pg) { pg = {}; } - let transformedParams = Object.assign({}, { // TODO: fix auctionId leak: https://github.com/prebid/Prebid.js/issues/9781 auctionid: bidderRequest.auctionId, diff --git a/test/spec/modules/jixieBidAdapter_spec.js b/test/spec/modules/jixieBidAdapter_spec.js index 5bf2a3b6fc9..78ed8843d3e 100644 --- a/test/spec/modules/jixieBidAdapter_spec.js +++ b/test/spec/modules/jixieBidAdapter_spec.js @@ -72,6 +72,10 @@ describe('jixie Adapter', function () { const clientIdTest1_ = '1aba6a40-f711-11e9-868c-53a2ae972xxx'; const sessionIdTest1_ = '1594782644-1aba6a40-f711-11e9-868c-53a2ae972xxx'; const jxtokoTest1_ = 'eyJJRCI6ImFiYyJ9'; + const jxifoTest1_ = 'fffffbbbbbcccccaaaaae890606aaaaa'; + const jxtdidTest1_ = '222223d1-1111-2222-3333-b9f129299999'; + const __uid2_advertising_token_Test1 = 'eyJJRCI6ImFiYyJ9'; + // to serve as the object that prebid will call jixie buildRequest with: (param2) const bidderRequest_ = { @@ -197,11 +201,22 @@ describe('jixie Adapter', function () { // similar to above test case but here we force some clientid sessionid values // and domain, pageurl // get the interceptors ready: + //['_jxtoko', '_jxifo', '_jxtdid', '__uid2_advertising_token'].forEach(function(n) { + let getCookieStub = sinon.stub(storage, 'getCookie'); let getLocalStorageStub = sinon.stub(storage, 'getDataFromLocalStorage'); getCookieStub .withArgs('_jxtoko') .returns(jxtokoTest1_); + getCookieStub + .withArgs('_jxifo') + .returns(jxifoTest1_); + getCookieStub + .withArgs('_jxtdid') + .returns(jxtdidTest1_); + getCookieStub + .withArgs('__uid2_advertising_token') + .returns(__uid2_advertising_token_Test1); getCookieStub .withArgs('_jxx') .returns(clientIdTest1_); From e2eb4c3e348e2ac1958e7da2e1e532515f560f20 Mon Sep 17 00:00:00 2001 From: Renee Woo Date: Fri, 18 Aug 2023 19:48:11 +1000 Subject: [PATCH 6/9] cleaned up --- modules/jixieBidAdapter.js | 13 +++---- test/spec/modules/jixieBidAdapter_spec.js | 44 +++++++++++++++++------ 2 files changed, 39 insertions(+), 18 deletions(-) diff --git a/modules/jixieBidAdapter.js b/modules/jixieBidAdapter.js index 9d62cb885ac..824bc3828b4 100644 --- a/modules/jixieBidAdapter.js +++ b/modules/jixieBidAdapter.js @@ -1,4 +1,4 @@ -import {deepAccess, isPlainObject, getDNT, isArray, logWarn} from '../src/utils.js'; +import {deepAccess, getDNT, isArray, logWarn} from '../src/utils.js'; import {config} from '../src/config.js'; import {registerBidder} from '../src/adapters/bidderFactory.js'; import {getStorageManager} from '../src/storageManager.js'; @@ -44,7 +44,7 @@ function fetchIds_() { client_id_ls: '', session_id_c: '', session_id_ls: '', - jxeids : {} + jxeids: {} }; try { let tmp = storage.getCookie('_jxx'); @@ -56,13 +56,10 @@ function fetchIds_() { if (tmp) ret.client_id_ls = tmp; tmp = storage.getDataFromLocalStorage('_jxxs'); if (tmp) ret.session_id_ls = tmp; - //we have a problem if we ['_jxtoko', '_jxifo', '_jxtdid', '__uid2_advertising_token'].forEach(function(n) { - tmp = storage.getCookie(n); - if (tmp) ret.jxeids[n] = tmp; + tmp = storage.getCookie(n); + if (tmp) ret.jxeids[n] = tmp; }); - tmp = storage.getCookie('_jxtoko'); - if (tmp) ret.jxtoko_id = tmp; } catch (error) {} return ret; } @@ -166,7 +163,7 @@ export const spec = { let bids = []; validBidRequests.forEach(function(one) { let gpid = deepAccess(one, 'ortb2Imp.ext.gpid', deepAccess(one, 'ortb2Imp.ext.data.pbadslot', '')); - let tmp = { + let tmp = { bidId: one.bidId, adUnitCode: one.adUnitCode, mediaTypes: (one.mediaTypes === 'undefined' ? {} : one.mediaTypes), diff --git a/test/spec/modules/jixieBidAdapter_spec.js b/test/spec/modules/jixieBidAdapter_spec.js index 78ed8843d3e..89ad4b3dbb4 100644 --- a/test/spec/modules/jixieBidAdapter_spec.js +++ b/test/spec/modules/jixieBidAdapter_spec.js @@ -74,8 +74,14 @@ describe('jixie Adapter', function () { const jxtokoTest1_ = 'eyJJRCI6ImFiYyJ9'; const jxifoTest1_ = 'fffffbbbbbcccccaaaaae890606aaaaa'; const jxtdidTest1_ = '222223d1-1111-2222-3333-b9f129299999'; - const __uid2_advertising_token_Test1 = 'eyJJRCI6ImFiYyJ9'; + const __uid2_advertising_token_Test1 = 'AAAAABBBBBCCCCCDDDDDEEEEEUkkZPQfifpkPnnlJhtsa4o+gf4nfqgN5qHiTVX73ymTSbLT9jz1nf+Q7QdxNh9nTad9UaN5pzfHMt/rs1woQw72c1ip+8heZXPfKGZtZP7ldJesYhlo3/0FVcL/wl9ZlAo1jYOEfHo7Y9zFzNXABbbbbb=='; + const refJxEids_ = { + '_jxtoko': jxtokoTest1_, + '_jxifo': jxifoTest1_, + '_jxtdid': jxtdidTest1_, + '__uid2_advertising_token': __uid2_advertising_token_Test1 + }; // to serve as the object that prebid will call jixie buildRequest with: (param2) const bidderRequest_ = { @@ -94,7 +100,12 @@ describe('jixie Adapter', function () { 'adUnitCode': adUnitCode0_, 'bidId': bidId0_, 'bidderRequestId': bidderRequestId_, - 'auctionId': auctionId_ + 'auctionId': auctionId_, + 'ortb2Imp': { + 'ext': { + 'gpid': 'SUPERNEWS#DESKTOP#div-gpt-ad-Top_1-1' + } + } }, { 'bidder': 'jixie', @@ -113,7 +124,12 @@ describe('jixie Adapter', function () { 'adUnitCode': adUnitCode1_, 'bidId': bidId1_, 'bidderRequestId': bidderRequestId_, - 'auctionId': auctionId_ + 'auctionId': auctionId_, + 'ortb2Imp': { + 'ext': { + 'gpid': 'SUPERNEWS#DESKTOP#div-gpt-ad-Top_1-2' + } + } }, { 'bidder': 'jixie', @@ -132,7 +148,12 @@ describe('jixie Adapter', function () { 'adUnitCode': adUnitCode2_, 'bidId': bidId2_, 'bidderRequestId': bidderRequestId_, - 'auctionId': auctionId_ + 'auctionId': auctionId_, + 'ortb2Imp': { + 'ext': { + 'gpid': 'SUPERNEWS#DESKTOP#div-gpt-ad-Top_1-3' + } + } } ]; @@ -145,7 +166,8 @@ describe('jixie Adapter', function () { 'sizes': [[300, 250], [300, 600]], 'params': { 'unit': 'prebidsampleunit' - } + }, + 'gpid': 'SUPERNEWS#DESKTOP#div-gpt-ad-Top_1-1' }, { 'bidId': bidId1_, @@ -161,7 +183,8 @@ describe('jixie Adapter', function () { 'sizes': [[300, 250]], 'params': { 'unit': 'prebidsampleunit' - } + }, + 'gpid': 'SUPERNEWS#DESKTOP#div-gpt-ad-Top_1-2' }, { 'bidId': bidId2_, @@ -177,7 +200,8 @@ describe('jixie Adapter', function () { 'sizes': [[300, 250], [300, 600]], 'params': { 'unit': 'prebidsampleunit' - } + }, + 'gpid': 'SUPERNEWS#DESKTOP#div-gpt-ad-Top_1-3' } ]; @@ -201,8 +225,7 @@ describe('jixie Adapter', function () { // similar to above test case but here we force some clientid sessionid values // and domain, pageurl // get the interceptors ready: - //['_jxtoko', '_jxifo', '_jxtdid', '__uid2_advertising_token'].forEach(function(n) { - + let getCookieStub = sinon.stub(storage, 'getCookie'); let getLocalStorageStub = sinon.stub(storage, 'getDataFromLocalStorage'); getCookieStub @@ -239,6 +262,7 @@ describe('jixie Adapter', function () { it('sends bid request to ENDPOINT via POST', function () { expect(request.method).to.equal('POST') }) + expect(request.data).to.be.an('string'); const payload = JSON.parse(request.data); expect(payload).to.have.property('auctionid', auctionId_); @@ -246,7 +270,7 @@ describe('jixie Adapter', function () { expect(payload).to.have.property('client_id_ls', clientIdTest1_); expect(payload).to.have.property('session_id_c', sessionIdTest1_); expect(payload).to.have.property('session_id_ls', sessionIdTest1_); - expect(payload).to.have.property('jxtoko_id', jxtokoTest1_); + expect(payload).to.have.property('jxeids').that.deep.equals(refJxEids_); expect(payload).to.have.property('device', device_); expect(payload).to.have.property('domain', domain_); expect(payload).to.have.property('pageurl', pageurl_); From 034b1fef6988e4de55b8d566a9b87e4b170b632f Mon Sep 17 00:00:00 2001 From: Renee Woo Date: Sat, 19 Aug 2023 09:49:22 +1000 Subject: [PATCH 7/9] correcting formatting errors from circleci --- test/spec/modules/jixieBidAdapter_spec.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/test/spec/modules/jixieBidAdapter_spec.js b/test/spec/modules/jixieBidAdapter_spec.js index 89ad4b3dbb4..4a0fa3b4d57 100644 --- a/test/spec/modules/jixieBidAdapter_spec.js +++ b/test/spec/modules/jixieBidAdapter_spec.js @@ -77,11 +77,11 @@ describe('jixie Adapter', function () { const __uid2_advertising_token_Test1 = 'AAAAABBBBBCCCCCDDDDDEEEEEUkkZPQfifpkPnnlJhtsa4o+gf4nfqgN5qHiTVX73ymTSbLT9jz1nf+Q7QdxNh9nTad9UaN5pzfHMt/rs1woQw72c1ip+8heZXPfKGZtZP7ldJesYhlo3/0FVcL/wl9ZlAo1jYOEfHo7Y9zFzNXABbbbbb=='; const refJxEids_ = { - '_jxtoko': jxtokoTest1_, - '_jxifo': jxifoTest1_, - '_jxtdid': jxtdidTest1_, - '__uid2_advertising_token': __uid2_advertising_token_Test1 - }; + '_jxtoko': jxtokoTest1_, + '_jxifo': jxifoTest1_, + '_jxtdid': jxtdidTest1_, + '__uid2_advertising_token': __uid2_advertising_token_Test1 + }; // to serve as the object that prebid will call jixie buildRequest with: (param2) const bidderRequest_ = { @@ -225,7 +225,6 @@ describe('jixie Adapter', function () { // similar to above test case but here we force some clientid sessionid values // and domain, pageurl // get the interceptors ready: - let getCookieStub = sinon.stub(storage, 'getCookie'); let getLocalStorageStub = sinon.stub(storage, 'getDataFromLocalStorage'); getCookieStub From 720885146508765be4f18cf399c41a17aefbda55 Mon Sep 17 00:00:00 2001 From: Renee Woo Date: Sat, 16 Sep 2023 08:17:14 +1000 Subject: [PATCH 8/9] sending floor to our backend for each bid, when available, changed one of the 1st party cookies that we want to send to backend --- modules/jixieBidAdapter.js | 31 ++++++++++++++++++++--- test/spec/modules/jixieBidAdapter_spec.js | 25 +++++++++++++++--- 2 files changed, 49 insertions(+), 7 deletions(-) diff --git a/modules/jixieBidAdapter.js b/modules/jixieBidAdapter.js index 824bc3828b4..3a5272d8254 100644 --- a/modules/jixieBidAdapter.js +++ b/modules/jixieBidAdapter.js @@ -1,4 +1,4 @@ -import {deepAccess, getDNT, isArray, logWarn} from '../src/utils.js'; +import {deepAccess, getDNT, isArray, logWarn, isFn, isPlainObject} from '../src/utils.js'; import {config} from '../src/config.js'; import {registerBidder} from '../src/adapters/bidderFactory.js'; import {getStorageManager} from '../src/storageManager.js'; @@ -14,6 +14,28 @@ const JX_OUTSTREAM_RENDERER_URL = 'https://scripts.jixie.media/jxhbrenderer.1.1. const REQUESTS_URL = 'https://hb.jixie.io/v2/hbpost'; const sidTTLMins_ = 30; + +/** + * Get bid floor from Price Floors Module + * + * @param {Object} bid + * @returns {float||null} + */ +function getBidFloor(bid) { + if (!isFn(bid.getFloor)) { + return null; + } + let floor = bid.getFloor({ + currency: 'USD', + mediaType: '*', + size: '*' + }); + if (isPlainObject(floor) && !isNaN(floor.floor) && floor.currency === 'USD') { + return floor.floor; + } + return null; +} + /** * Own miscellaneous support functions: */ @@ -56,7 +78,7 @@ function fetchIds_() { if (tmp) ret.client_id_ls = tmp; tmp = storage.getDataFromLocalStorage('_jxxs'); if (tmp) ret.session_id_ls = tmp; - ['_jxtoko', '_jxifo', '_jxtdid', '__uid2_advertising_token'].forEach(function(n) { + ['_jxtoko', '_jxifo', '_jxtdid', '_jxcomp'].forEach(function(n) { tmp = storage.getCookie(n); if (tmp) ret.jxeids[n] = tmp; }); @@ -171,9 +193,12 @@ export const spec = { params: one.params, gpid: gpid }; + let bidFloor = getBidFloor(one); + if (bidFloor) { + tmp.bidFloor = bidFloor; + } bids.push(tmp); }); - let jixieCfgBlob = config.getConfig('jixie'); if (!jixieCfgBlob) { jixieCfgBlob = {}; diff --git a/test/spec/modules/jixieBidAdapter_spec.js b/test/spec/modules/jixieBidAdapter_spec.js index 4a0fa3b4d57..241abe20a4d 100644 --- a/test/spec/modules/jixieBidAdapter_spec.js +++ b/test/spec/modules/jixieBidAdapter_spec.js @@ -2,6 +2,7 @@ import { expect } from 'chai'; import { spec, internal as jixieaux, storage } from 'modules/jixieBidAdapter.js'; import { newBidder } from 'src/adapters/bidderFactory.js'; import { config } from 'src/config.js'; +import { deepClone } from 'src/utils.js'; describe('jixie Adapter', function () { const pageurl_ = 'https://testdomain.com/testpage.html'; @@ -74,13 +75,13 @@ describe('jixie Adapter', function () { const jxtokoTest1_ = 'eyJJRCI6ImFiYyJ9'; const jxifoTest1_ = 'fffffbbbbbcccccaaaaae890606aaaaa'; const jxtdidTest1_ = '222223d1-1111-2222-3333-b9f129299999'; - const __uid2_advertising_token_Test1 = 'AAAAABBBBBCCCCCDDDDDEEEEEUkkZPQfifpkPnnlJhtsa4o+gf4nfqgN5qHiTVX73ymTSbLT9jz1nf+Q7QdxNh9nTad9UaN5pzfHMt/rs1woQw72c1ip+8heZXPfKGZtZP7ldJesYhlo3/0FVcL/wl9ZlAo1jYOEfHo7Y9zFzNXABbbbbb=='; + const jxcompTest1_ = 'AAAAABBBBBCCCCCDDDDDEEEEEUkkZPQfifpkPnnlJhtsa4o+gf4nfqgN5qHiTVX73ymTSbLT9jz1nf+Q7QdxNh9nTad9UaN5pzfHMt/rs1woQw72c1ip+8heZXPfKGZtZP7ldJesYhlo3/0FVcL/wl9ZlAo1jYOEfHo7Y9zFzNXABbbbbb=='; const refJxEids_ = { '_jxtoko': jxtokoTest1_, '_jxifo': jxifoTest1_, '_jxtdid': jxtdidTest1_, - '__uid2_advertising_token': __uid2_advertising_token_Test1 + '_jxcomp': jxcompTest1_ }; // to serve as the object that prebid will call jixie buildRequest with: (param2) @@ -237,8 +238,8 @@ describe('jixie Adapter', function () { .withArgs('_jxtdid') .returns(jxtdidTest1_); getCookieStub - .withArgs('__uid2_advertising_token') - .returns(__uid2_advertising_token_Test1); + .withArgs('_jxcomp') + .returns(jxcompTest1_); getCookieStub .withArgs('_jxx') .returns(clientIdTest1_); @@ -345,6 +346,22 @@ describe('jixie Adapter', function () { expect(payload.schain).to.deep.include(schain); }); + it('it should populate the floor info when available', function () { + let oneSpecialBidReq = deepClone(bidRequests_[0]); + let request, payload = null; + // 1 floor is not set + request = spec.buildRequests([oneSpecialBidReq], bidderRequest_); + payload = JSON.parse(request.data); + expect(payload.bids[0].bidFloor).to.not.exist; + + // 2 floor is set + let getFloorResponse = { currency: 'USD', floor: 2.1 }; + oneSpecialBidReq.getFloor = () => getFloorResponse; + request = spec.buildRequests([oneSpecialBidReq], bidderRequest_); + payload = JSON.parse(request.data); + expect(payload.bids[0].bidFloor).to.exist.and.to.equal(2.1); + }); + it('should populate eids when supported userIds are available', function () { const oneSpecialBidReq = Object.assign({}, bidRequests_[0], { userIdAsEids: [ From 7574d30527bfe0d9a188c16b61bc41c439e2b57f Mon Sep 17 00:00:00 2001 From: Renee Woo Date: Sat, 16 Sep 2023 08:54:35 +1000 Subject: [PATCH 9/9] fixed spacing issues in code --- modules/jixieBidAdapter.js | 3 +-- test/spec/modules/jixieBidAdapter_spec.js | 26 +++++++++++------------ 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/modules/jixieBidAdapter.js b/modules/jixieBidAdapter.js index 3a5272d8254..103c925a2f9 100644 --- a/modules/jixieBidAdapter.js +++ b/modules/jixieBidAdapter.js @@ -14,7 +14,6 @@ const JX_OUTSTREAM_RENDERER_URL = 'https://scripts.jixie.media/jxhbrenderer.1.1. const REQUESTS_URL = 'https://hb.jixie.io/v2/hbpost'; const sidTTLMins_ = 30; - /** * Get bid floor from Price Floors Module * @@ -35,7 +34,7 @@ function getBidFloor(bid) { } return null; } - + /** * Own miscellaneous support functions: */ diff --git a/test/spec/modules/jixieBidAdapter_spec.js b/test/spec/modules/jixieBidAdapter_spec.js index 241abe20a4d..fd0d7e8a033 100644 --- a/test/spec/modules/jixieBidAdapter_spec.js +++ b/test/spec/modules/jixieBidAdapter_spec.js @@ -347,19 +347,19 @@ describe('jixie Adapter', function () { }); it('it should populate the floor info when available', function () { - let oneSpecialBidReq = deepClone(bidRequests_[0]); - let request, payload = null; - // 1 floor is not set - request = spec.buildRequests([oneSpecialBidReq], bidderRequest_); - payload = JSON.parse(request.data); - expect(payload.bids[0].bidFloor).to.not.exist; - - // 2 floor is set - let getFloorResponse = { currency: 'USD', floor: 2.1 }; - oneSpecialBidReq.getFloor = () => getFloorResponse; - request = spec.buildRequests([oneSpecialBidReq], bidderRequest_); - payload = JSON.parse(request.data); - expect(payload.bids[0].bidFloor).to.exist.and.to.equal(2.1); + let oneSpecialBidReq = deepClone(bidRequests_[0]); + let request, payload = null; + // 1 floor is not set + request = spec.buildRequests([oneSpecialBidReq], bidderRequest_); + payload = JSON.parse(request.data); + expect(payload.bids[0].bidFloor).to.not.exist; + + // 2 floor is set + let getFloorResponse = { currency: 'USD', floor: 2.1 }; + oneSpecialBidReq.getFloor = () => getFloorResponse; + request = spec.buildRequests([oneSpecialBidReq], bidderRequest_); + payload = JSON.parse(request.data); + expect(payload.bids[0].bidFloor).to.exist.and.to.equal(2.1); }); it('should populate eids when supported userIds are available', function () {