diff --git a/modules/nextMillenniumBidAdapter.js b/modules/nextMillenniumBidAdapter.js index 375258176da..f873e5b5c29 100644 --- a/modules/nextMillenniumBidAdapter.js +++ b/modules/nextMillenniumBidAdapter.js @@ -1,4 +1,5 @@ import { isStr, _each, parseUrl, getWindowTop, getBidIdParameter } from '../src/utils.js'; +import { getRefererInfo } from '../src/refererDetection.js'; import { registerBidder } from '../src/adapters/bidderFactory.js'; import { BANNER } from '../src/mediaTypes.js'; @@ -24,12 +25,18 @@ export const spec = { _each(validBidRequests, function(bid) { window.nmmRefreshCounts[bid.adUnitCode] = window.nmmRefreshCounts[bid.adUnitCode] || 0; + const id = getPlacementId(bid) + + 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': { 'prebid': { 'storedrequest': { - 'id': getPlacementId(bid) + 'id': id } }, @@ -39,7 +46,19 @@ export const spec = { 'scrollTop': window.pageYOffset || document.documentElement.scrollTop } }, - ...bid.ortb2 + ...bid.ortb2, + 'imp': [{ + 'banner': { + 'format': (bid.sizes || []).map(s => { return {w: s[0], h: s[1]} }) + }, + 'ext': { + 'prebid': { + 'storedrequest': { + 'id': id + } + } + } + }] } const gdprConsent = bidderRequest && bidderRequest.gdprConsent; diff --git a/test/spec/modules/nextMillenniumBidAdapter_spec.js b/test/spec/modules/nextMillenniumBidAdapter_spec.js index 9362388b539..40005356fd8 100644 --- a/test/spec/modules/nextMillenniumBidAdapter_spec.js +++ b/test/spec/modules/nextMillenniumBidAdapter_spec.js @@ -114,6 +114,23 @@ 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') + }) + + it('Check if imp prebid stored id is correct', function() { + const request = spec.buildRequests(bidRequestData) + const requestData = JSON.parse(request[0].data); + const storedReqId = requestData.ext.prebid.storedrequest.id; + expect(requestData.imp[0].ext.prebid.storedrequest.id).to.equal(storedReqId) + }) + it('Test getUserSyncs function', function () { const syncOptions = { 'iframeEnabled': true