diff --git a/modules/nextMillenniumBidAdapter.js b/modules/nextMillenniumBidAdapter.js index f873e5b5c29..87d2e53568f 100644 --- a/modules/nextMillenniumBidAdapter.js +++ b/modules/nextMillenniumBidAdapter.js @@ -26,11 +26,12 @@ export const spec = { _each(validBidRequests, function(bid) { window.nmmRefreshCounts[bid.adUnitCode] = window.nmmRefreshCounts[bid.adUnitCode] || 0; const id = getPlacementId(bid) + let sizes = bid.sizes + if (sizes && !Array.isArray(sizes[0])) sizes = [sizes] + + const site = getSiteObj() + const device = getDeviceObj() - if (bid.sizes && !Array.isArray(bid.sizes[0])) bid.sizes = [bid.sizes] - if (!bid.ortb2) bid.ortb2 = {} - if (!bid.ortb2.device) bid.ortb2.device = {} - bid.ortb2.device.referrer = (getRefererInfo && getRefererInfo().ref) || '' const postBody = { 'id': bid.auctionId, 'ext': { @@ -46,10 +47,11 @@ export const spec = { 'scrollTop': window.pageYOffset || document.documentElement.scrollTop } }, - ...bid.ortb2, + device, + site, 'imp': [{ 'banner': { - 'format': (bid.sizes || []).map(s => { return {w: s[0], h: s[1]} }) + 'format': (sizes || []).map(s => { return {w: s[0], h: s[1]} }) }, 'ext': { 'prebid': { @@ -198,4 +200,21 @@ function getTopWindow(curWindow, nesting = 0) { } } +function getSiteObj() { + const refInfo = (getRefererInfo && getRefererInfo()) || {} + + return { + page: refInfo.page, + ref: refInfo.ref, + domain: refInfo.domain + } +} + +function getDeviceObj() { + return { + w: window.innerWidth || window.document.documentElement.clientWidth || window.document.body.clientWidth || 0, + h: window.innerHeight || window.document.documentElement.clientHeight || window.document.body.clientHeight || 0, + } +} + registerBidder(spec); diff --git a/test/spec/modules/nextMillenniumBidAdapter_spec.js b/test/spec/modules/nextMillenniumBidAdapter_spec.js index 40005356fd8..303025888dc 100644 --- a/test/spec/modules/nextMillenniumBidAdapter_spec.js +++ b/test/spec/modules/nextMillenniumBidAdapter_spec.js @@ -104,9 +104,9 @@ describe('nextMillenniumBidAdapterTests', function() { expect(JSON.parse(request[0].data).ext.nextMillennium.refresh_count).to.equal(3); }); - it('Check if ORTB was added', function() { + it('Check if domain was added', function() { const request = spec.buildRequests(bidRequestData) - expect(JSON.parse(request[0].data).site.domain).to.equal('example.com') + expect(JSON.parse(request[0].data).site.domain).to.exist }) it('Check if elOffsets was added', function() { @@ -114,11 +114,6 @@ describe('nextMillenniumBidAdapterTests', function() { expect(JSON.parse(request[0].data).ext.nextMillennium.elOffsets).to.be.an('object') }) - it('Check if refferer was added', function() { - const request = spec.buildRequests(bidRequestData) - expect(JSON.parse(request[0].data).device.referrer).to.exist - }) - it('Check if imp object was added', function() { const request = spec.buildRequests(bidRequestData) expect(JSON.parse(request[0].data).imp).to.be.an('array')