From 8c6d94991ae9187381fc09fb8f36b120700de614 Mon Sep 17 00:00:00 2001 From: Love Sharma Date: Mon, 6 Jun 2022 16:17:43 -0400 Subject: [PATCH 1/7] outstream video float support --- modules/ixBidAdapter.js | 8 ++++++-- modules/ixBidAdapter.md | 11 ++++++++++- test/spec/modules/ixBidAdapter_spec.js | 17 +++++++++++++++-- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/modules/ixBidAdapter.js b/modules/ixBidAdapter.js index 1e3ad7b12d2..304f340b3a8 100644 --- a/modules/ixBidAdapter.js +++ b/modules/ixBidAdapter.js @@ -41,7 +41,7 @@ const VIDEO_TIME_TO_LIVE = 3600; // 1hr const NET_REVENUE = true; const MAX_REQUEST_SIZE = 8000; const MAX_REQUEST_LIMIT = 4; -const OUTSTREAM_MINIMUM_PLAYER_SIZE = [300, 250]; +const OUTSTREAM_MINIMUM_PLAYER_SIZE = [144, 144]; const PRICE_TO_DOLLAR_FACTOR = { JPY: 1 }; @@ -178,7 +178,11 @@ function bidToVideoImp(bid) { if (context === INSTREAM) { imp.video.placement = 1; } else if (context === OUTSTREAM) { - imp.video.placement = 4; + if (deepAccess(videoParamRef, 'playerConfig.floatOnScroll')) { + imp.video.placement = 5; + } else { + imp.video.placement = 4; + } } else { logWarn(`IX Bid Adapter: Video context '${context}' is not supported`); } diff --git a/modules/ixBidAdapter.md b/modules/ixBidAdapter.md index 415fdc9db65..b3c0a05ed30 100644 --- a/modules/ixBidAdapter.md +++ b/modules/ixBidAdapter.md @@ -77,6 +77,9 @@ object are detailed here. |video.minduration| Required | Integer | Minimum video ad duration in seconds. |video.maxduration| Required | Integer | Maximum video ad duration in seconds. |video.protocol / video.protocols| Required | Integer / Integer[] | Either a single protocol provided as an integer, or protocols provided as a list of integers. `2` - VAST 2.0, `3` - VAST 3.0, `5` - VAST 2.0 Wrapper, `6` - VAST 3.0 Wrapper +| video.playerConfig | Optional | Hash | The Index specific outstream player configurations. +| video.playerConfig.floatOnScroll | Optional | Boolean | A boolean specifying whether you want to use the player’s floating capabilities, where:
- `true`: Allow the player to float.
Note: If you set floatOnScroll to true, Index updates the placement value to `5`.
- `false`: Do not allow the player to float (default). +| video.playerConfig.floatSize | Optional | Integer[] | The height and width of the floating player in pixels. If you do not specify a float size, the player adjusts to the aspect ratio of the player size that is defined when it is not floating. Index recommends that you review and test the float size to your user experience preference. ## Deprecation warning @@ -247,13 +250,19 @@ var adUnits = [{ minduration: 5, maxduration: 30, mimes: ['video/mp4', 'application/javascript'], - placement: 3 + placement: 5 } }, bids: [{ bidder: 'ix', params: { siteId: '715964' + video: { + playerConfig: { + floatOnScroll: true, + floatSize: [300,250] + } + } } }] }]; diff --git a/test/spec/modules/ixBidAdapter_spec.js b/test/spec/modules/ixBidAdapter_spec.js index 9fe3bd8fb22..6b3ed4011da 100644 --- a/test/spec/modules/ixBidAdapter_spec.js +++ b/test/spec/modules/ixBidAdapter_spec.js @@ -596,10 +596,10 @@ describe('IndexexchangeAdapter', function () { }); describe('isBidRequestValid', function () { - it('should return false if outstream player size is less than 300x250 and IX renderer is preferred', function () { + it('should return false if outstream player size is less than 144x144 and IX renderer is preferred', function () { const bid = utils.deepClone(DEFAULT_VIDEO_VALID_BID[0]); bid.mediaTypes.video.context = 'outstream'; - bid.mediaTypes.video.playerSize = [[300, 249]]; + bid.mediaTypes.video.playerSize = [[300, 143]]; expect(spec.isBidRequestValid(bid)).to.equal(false); }); @@ -2220,6 +2220,19 @@ describe('IndexexchangeAdapter', function () { expect(videoImpression.video.w).to.equal(DEFAULT_VIDEO_VALID_BID_NO_VIDEO_PARAMS[0].mediaTypes.video.playerSize[0][0]); expect(videoImpression.video.h).to.equal(DEFAULT_VIDEO_VALID_BID_NO_VIDEO_PARAMS[0].mediaTypes.video.playerSize[0][1]); }); + + it('should set different placement for floating ad units', () => { + const bid = utils.deepClone(DEFAULT_VIDEO_VALID_BID[0]); + bid.mediaTypes.video.context = 'outstream'; + bid.params.video.playerConfig = { + floatOnScroll: true + }; + + const request = spec.buildRequests([bid]); + const videoImpression = JSON.parse(request[0].data.r).imp[0]; + + expect(videoImpression.video.placement).to.eq(5); + }) }); describe('buildRequestMultiFormat', function () { From a7ae45e6c7349234e43d3c6ec06623b8412f9fbe Mon Sep 17 00:00:00 2001 From: Love Sharma Date: Mon, 6 Jun 2022 16:29:10 -0400 Subject: [PATCH 2/7] tmax to ixdiag --- modules/ixBidAdapter.js | 4 ++++ test/spec/modules/ixBidAdapter_spec.js | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/modules/ixBidAdapter.js b/modules/ixBidAdapter.js index 304f340b3a8..94f681d3092 100644 --- a/modules/ixBidAdapter.js +++ b/modules/ixBidAdapter.js @@ -532,6 +532,7 @@ function buildRequest(validBidRequests, bidderRequest, impressions, version) { } const r = {}; + const tmax = config.getConfig('bidderTimeout'); // Since bidderRequestId are the same for different bid request, just use the first one. r.id = validBidRequests[0].bidderRequestId.toString(); @@ -550,6 +551,9 @@ function buildRequest(validBidRequests, bidderRequest, impressions, version) { r.ext.ixdiag[key] = ixdiag[key]; } + if (tmax) { + r.ext.ixdiag.tmax = tmax + } // Get cached errors stored in LocalStorage const cachedErrors = getCachedErrors(); diff --git a/test/spec/modules/ixBidAdapter_spec.js b/test/spec/modules/ixBidAdapter_spec.js index 6b3ed4011da..37987786924 100644 --- a/test/spec/modules/ixBidAdapter_spec.js +++ b/test/spec/modules/ixBidAdapter_spec.js @@ -1341,6 +1341,27 @@ describe('IndexexchangeAdapter', function () { expect(r.ext.ixdiag.fpd).to.exist; }); + it('should set ixdiag.tmax value if it exists using tmax', function () { + config.setConfig({ + bidderTimeout: 250 + }); + + const request = spec.buildRequests(DEFAULT_BANNER_VALID_BID)[0]; + const r = JSON.parse(request.data.r); + + expect(r.ext.ixdiag.tmax).to.equal(250); + }); + + it('should not set ixdiag.tmax value if bidderTimeout is undefined', function () { + config.setConfig({ + bidderTimeout: null + }) + const request = spec.buildRequests(DEFAULT_BANNER_VALID_BID)[0]; + const r = JSON.parse(request.data.r); + + expect(r.ext.ixdiag.tmax).to.be.undefined + }); + it('should set ixdiag.fpd value if it exists using ortb2', function () { config.setConfig({ ortb2: { From 6ac5c2322e61e92e91eb9608f9a6b071f29730df Mon Sep 17 00:00:00 2001 From: Love Sharma Date: Thu, 9 Jun 2022 16:36:58 -0400 Subject: [PATCH 3/7] added deep access to ortb2 --- modules/ixBidAdapter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ixBidAdapter.js b/modules/ixBidAdapter.js index dcbcbf71114..3c24f678aa4 100644 --- a/modules/ixBidAdapter.js +++ b/modules/ixBidAdapter.js @@ -733,7 +733,7 @@ function buildRequest(validBidRequests, bidderRequest, impressions, version) { currentRequestSize += currentImpressionSize; - const fpd = bidderRequest.ortb2 || {}; + const fpd = deepAccess(bidderRequest, 'ortb2') || {}; if (!isEmpty(fpd) && !isFpdAdded) { r.ext.ixdiag.fpd = true; From 331d159a552214807aa97204471c652e89c543ef Mon Sep 17 00:00:00 2001 From: Love Sharma Date: Thu, 9 Jun 2022 17:07:32 -0400 Subject: [PATCH 4/7] fixed ortb2 test cases --- test/spec/modules/ixBidAdapter_spec.js | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/test/spec/modules/ixBidAdapter_spec.js b/test/spec/modules/ixBidAdapter_spec.js index a514cd2e270..315b79aece0 100644 --- a/test/spec/modules/ixBidAdapter_spec.js +++ b/test/spec/modules/ixBidAdapter_spec.js @@ -1241,7 +1241,7 @@ describe('IndexexchangeAdapter', function () { } }; - const request = spec.buildRequests(DEFAULT_BANNER_VALID_BID)[0]; + const request = spec.buildRequests(DEFAULT_BANNER_VALID_BID, {ortb2})[0]; const r = JSON.parse(request.data.r); expect(r.ext.ixdiag.fpd).to.exist; @@ -1268,25 +1268,6 @@ describe('IndexexchangeAdapter', function () { expect(r.ext.ixdiag.tmax).to.be.undefined }); - it('should set ixdiag.fpd value if it exists using ortb2', function () { - config.setConfig({ - ortb2: { - site: { - ext: { - data: { - pageType: 'article' - } - } - } - } - }); - - const request = spec.buildRequests(DEFAULT_BANNER_VALID_BID, {ortb2})[0]; - const r = JSON.parse(request.data.r); - - expect(r.ext.ixdiag.fpd).to.exist; - }); - it('should not send information that is not part of openRTB spec v2.5 using ortb2', function () { const ortb2 = { site: { From ea46e75961e942bb1753d8cd45765da5b30c481a Mon Sep 17 00:00:00 2001 From: Love Sharma Date: Mon, 13 Jun 2022 13:07:12 -0400 Subject: [PATCH 5/7] Update ixBidAdapter.js --- modules/ixBidAdapter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ixBidAdapter.js b/modules/ixBidAdapter.js index 3c24f678aa4..2796988b9b3 100644 --- a/modules/ixBidAdapter.js +++ b/modules/ixBidAdapter.js @@ -1260,7 +1260,7 @@ export const spec = { const videoImp = bidToVideoImp(bid).video; if (deepAccess(bid, 'mediaTypes.video.context') === OUTSTREAM && isIndexRendererPreferred(bid) && videoImp) { - const outstreamPlayerSize = deepAccess(videoImp, 'playerSize')[0]; + const outstreamPlayerSize = deepAccess(videoImp, 'playerSize'); const isValidSize = outstreamPlayerSize[0] >= OUTSTREAM_MINIMUM_PLAYER_SIZE[0] && outstreamPlayerSize[1] >= OUTSTREAM_MINIMUM_PLAYER_SIZE[1]; if (!isValidSize) { logError(`IX Bid Adapter: ${mediaTypeVideoPlayerSize} is an invalid size for IX outstream renderer`); From 2c0f91bb6f49ea1508d95a5505e36b9065052b3f Mon Sep 17 00:00:00 2001 From: Love Sharma Date: Mon, 13 Jun 2022 13:58:14 -0400 Subject: [PATCH 6/7] updated outstream player size test --- modules/ixBidAdapter.js | 2 +- test/spec/modules/ixBidAdapter_spec.js | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/modules/ixBidAdapter.js b/modules/ixBidAdapter.js index 2796988b9b3..58020f20433 100644 --- a/modules/ixBidAdapter.js +++ b/modules/ixBidAdapter.js @@ -1260,7 +1260,7 @@ export const spec = { const videoImp = bidToVideoImp(bid).video; if (deepAccess(bid, 'mediaTypes.video.context') === OUTSTREAM && isIndexRendererPreferred(bid) && videoImp) { - const outstreamPlayerSize = deepAccess(videoImp, 'playerSize'); + const outstreamPlayerSize = [deepAccess(videoImp, 'w'), deepAccess(videoImp, 'h')]; const isValidSize = outstreamPlayerSize[0] >= OUTSTREAM_MINIMUM_PLAYER_SIZE[0] && outstreamPlayerSize[1] >= OUTSTREAM_MINIMUM_PLAYER_SIZE[1]; if (!isValidSize) { logError(`IX Bid Adapter: ${mediaTypeVideoPlayerSize} is an invalid size for IX outstream renderer`); diff --git a/test/spec/modules/ixBidAdapter_spec.js b/test/spec/modules/ixBidAdapter_spec.js index 315b79aece0..80cf3ad09ff 100644 --- a/test/spec/modules/ixBidAdapter_spec.js +++ b/test/spec/modules/ixBidAdapter_spec.js @@ -585,7 +585,21 @@ describe('IndexexchangeAdapter', function () { it('should return false if outstream player size is less than 144x144 and IX renderer is preferred', function () { const bid = utils.deepClone(DEFAULT_VIDEO_VALID_BID[0]); bid.mediaTypes.video.context = 'outstream'; - bid.mediaTypes.video.playerSize = [[300, 143]]; + bid.mediaTypes.video.w = [[300, 143]]; + expect(spec.isBidRequestValid(bid)).to.equal(false); + bid.mediaTypes.video.w = [[143, 300]]; + expect(spec.isBidRequestValid(bid)).to.equal(false); + }); + + it('should return false if outstream video w & h is less than 144x144 and IX renderer is preferred', function () { + const bid = utils.deepClone(DEFAULT_VIDEO_VALID_BID[0]); + bid.mediaTypes.video.context = 'outstream'; + bid.mediaTypes.video.playerSize = [[300, 250]]; + bid.mediaTypes.video.w = 300; + bid.mediaTypes.video.h = 142; + expect(spec.isBidRequestValid(bid)).to.equal(false); + bid.mediaTypes.video.h = 300; + bid.mediaTypes.video.w = 142; expect(spec.isBidRequestValid(bid)).to.equal(false); }); From 6b92234cf4416562629b4e8e80c11eba2b737a80 Mon Sep 17 00:00:00 2001 From: Love Sharma Date: Mon, 13 Jun 2022 14:08:56 -0400 Subject: [PATCH 7/7] error messagae verbiage update --- modules/ixBidAdapter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ixBidAdapter.js b/modules/ixBidAdapter.js index 58020f20433..05c176a814f 100644 --- a/modules/ixBidAdapter.js +++ b/modules/ixBidAdapter.js @@ -1263,7 +1263,7 @@ export const spec = { const outstreamPlayerSize = [deepAccess(videoImp, 'w'), deepAccess(videoImp, 'h')]; const isValidSize = outstreamPlayerSize[0] >= OUTSTREAM_MINIMUM_PLAYER_SIZE[0] && outstreamPlayerSize[1] >= OUTSTREAM_MINIMUM_PLAYER_SIZE[1]; if (!isValidSize) { - logError(`IX Bid Adapter: ${mediaTypeVideoPlayerSize} is an invalid size for IX outstream renderer`); + logError(`IX Bid Adapter: ${outstreamPlayerSize} is an invalid size for IX outstream renderer`); return false; } }