From 63fb1ecdd0004cb6c8e50be146895941b6e3d9b1 Mon Sep 17 00:00:00 2001 From: abrowning14 Date: Wed, 6 May 2020 10:06:00 +0300 Subject: [PATCH 1/9] Added banner support for Dynamic Ad Placement (DAP) --- modules/oneVideoBidAdapter.js | 19 ++++++++++++++++--- package-lock.json | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/modules/oneVideoBidAdapter.js b/modules/oneVideoBidAdapter.js index 5747c5e848d..9548fcffbd5 100644 --- a/modules/oneVideoBidAdapter.js +++ b/modules/oneVideoBidAdapter.js @@ -8,7 +8,7 @@ export const spec = { SYNC_ENDPOINT1: 'https://cm.g.doubleclick.net/pixel?google_nid=adaptv_dbm&google_cm&google_sc', SYNC_ENDPOINT2: 'https://pr-bh.ybp.yahoo.com/sync/adaptv_ortb/{combo_uid}', SYNC_ENDPOINT3: 'https://match.adsrvr.org/track/cmf/generic?ttd_pid=adaptv&ttd_tpi=1', - supportedMediaTypes: ['video'], + supportedMediaTypes: ['video', 'banner'], /** * Determines whether or not the given bid request is valid. * @@ -82,18 +82,31 @@ export const spec = { creativeId: bid.crid, width: size.width, height: size.height, - mediaType: 'video', currency: response.cur, ttl: 100, netRevenue: true, adUnitCode: bidRequest.adUnitCode }; + + if (bidRequest.mediaTypes.banner) { + bidResponse.mediaType = 'banner' + } else { + bidResponse.mediaType = 'video' + } + + if (bid.nurl) { bidResponse.vastUrl = bid.nurl; + } else if (bid.adm && bidRequest.params.video.display === 1) { + bidResponse.ad = bid.adm } else if (bid.adm) { bidResponse.vastXml = bid.adm; } - bidResponse.renderer = (bidRequest.mediaTypes.video.context === 'outstream') ? newRenderer(bidRequest, bidResponse) : undefined; + + if (bidRequest.mediaTypes.video) { + bidResponse.renderer = (bidRequest.mediaTypes.video.context === 'outstream') ? newRenderer(bidRequest, bidResponse) : undefined; + } + return bidResponse; }, /** diff --git a/package-lock.json b/package-lock.json index e8387d41383..b325e77745c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "prebid.js", - "version": "3.18.0-pre", + "version": "3.19.0-pre", "lockfileVersion": 1, "requires": true, "dependencies": { From 3c6c2a2e695783253a747b1c486524b50d38313b Mon Sep 17 00:00:00 2001 From: abrowning14 Date: Wed, 6 May 2020 12:50:42 +0300 Subject: [PATCH 2/9] updated version number --- modules/oneVideoBidAdapter.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/oneVideoBidAdapter.js b/modules/oneVideoBidAdapter.js index 9548fcffbd5..17f1fcbcb17 100644 --- a/modules/oneVideoBidAdapter.js +++ b/modules/oneVideoBidAdapter.js @@ -3,7 +3,7 @@ import {registerBidder} from '../src/adapters/bidderFactory.js'; const BIDDER_CODE = 'oneVideo'; export const spec = { code: 'oneVideo', - VERSION: '3.0.1', + VERSION: '3.0.2', ENDPOINT: 'https://ads.adaptv.advertising.com/rtb/openrtb?ext_id=', SYNC_ENDPOINT1: 'https://cm.g.doubleclick.net/pixel?google_nid=adaptv_dbm&google_cm&google_sc', SYNC_ENDPOINT2: 'https://pr-bh.ybp.yahoo.com/sync/adaptv_ortb/{combo_uid}', @@ -94,7 +94,6 @@ export const spec = { bidResponse.mediaType = 'video' } - if (bid.nurl) { bidResponse.vastUrl = bid.nurl; } else if (bid.adm && bidRequest.params.video.display === 1) { From a012f1a080a9abcd797f3ec48277b0936e58685f Mon Sep 17 00:00:00 2001 From: abrowning14 Date: Wed, 6 May 2020 15:15:38 +0300 Subject: [PATCH 3/9] changed version to 3.0.2 in both adapter and tests _spec --- modules/oneVideoBidAdapter.js | 7 ++++++- test/spec/modules/oneVideoBidAdapter_spec.js | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/oneVideoBidAdapter.js b/modules/oneVideoBidAdapter.js index 17f1fcbcb17..2d9989089b6 100644 --- a/modules/oneVideoBidAdapter.js +++ b/modules/oneVideoBidAdapter.js @@ -21,7 +21,12 @@ export const spec = { } // Video validations - if (typeof bid.params.video === 'undefined' || typeof bid.params.video.playerWidth === 'undefined' || typeof bid.params.video.playerHeight == 'undefined' || typeof bid.params.video.mimes == 'undefined') { + if (typeof bid.params.video === 'undefined' || typeof bid.params.video.playerWidth === 'undefined' || typeof bid.params.video.playerHeight == 'undefined' || typeof bid.params.video.mimes == 'undefined' || (bid.mediaTypes.video.context === 'outstream' && bid.params.video.display === 1)) { + return false; + } + + // Banner DAP validation + if (bid.mediaTypes.banner && typeof bid.params.video.display === 'undefined') { return false; } diff --git a/test/spec/modules/oneVideoBidAdapter_spec.js b/test/spec/modules/oneVideoBidAdapter_spec.js index 82546f2e96d..3cc093eeadc 100644 --- a/test/spec/modules/oneVideoBidAdapter_spec.js +++ b/test/spec/modules/oneVideoBidAdapter_spec.js @@ -136,7 +136,7 @@ describe('OneVideoBidAdapter', function () { const placement = bidRequest.params.video.placement; const rewarded = bidRequest.params.video.rewarded; const inventoryid = bidRequest.params.video.inventoryid; - const VERSION = '3.0.1'; + const VERSION = '3.0.2'; expect(data.imp[0].video.w).to.equal(width); expect(data.imp[0].video.h).to.equal(height); expect(data.imp[0].bidfloor).to.equal(bidRequest.params.bidfloor); From f041f11c01ca308e468903c352fc6e89f3957871 Mon Sep 17 00:00:00 2001 From: abrowning14 Date: Wed, 6 May 2020 16:29:45 +0300 Subject: [PATCH 4/9] Added DAP Banner test for interpretResponse & isBidRequestValid --- test/spec/modules/oneVideoBidAdapter_spec.js | 74 ++++++++++++++++++-- 1 file changed, 69 insertions(+), 5 deletions(-) diff --git a/test/spec/modules/oneVideoBidAdapter_spec.js b/test/spec/modules/oneVideoBidAdapter_spec.js index 3cc093eeadc..f806d5c5b2f 100644 --- a/test/spec/modules/oneVideoBidAdapter_spec.js +++ b/test/spec/modules/oneVideoBidAdapter_spec.js @@ -90,7 +90,7 @@ describe('OneVideoBidAdapter', function () { }; expect(spec.isBidRequestValid(bidRequest)).to.equal(false); }); - it('should return true when the "pubId" param is missing', function () { + it('should return true when the "pubId" param exists', function () { bidRequest.params = { video: { playerWidth: 480, @@ -115,6 +115,50 @@ describe('OneVideoBidAdapter', function () { bidRequest.params = {}; expect(spec.isBidRequestValid(bidRequest)).to.equal(false); }); + + it('should return false when the mediaType is "banner" and display="undefined" (DAP 3P)', function () { + bidRequest = { + mediaTypes: { + banner: { + sizes: [640, 480] + } + } + } + expect(spec.isBidRequestValid(bidRequest)).to.equal(false); + }) + + it('should return true when the mediaType is "banner" and display=1 (DAP 3P)', function () { + bidRequest = { + mediaTypes: { + banner: { + sizes: [640, 480] + } + }, + params: { + video: { + display: 1 + } + } + } + expect(spec.isBidRequestValid(bidRequest)).to.equal(true); + }) + + it('should return false when the mediaType is "video" and context="outstream" and display=1 (DAP 3P)', function () { + bidRequest = { + mediaTypes: { + video: { + context: 'outstream', + playerSize: [640, 480] + } + }, + params: { + video: { + display: 1 + } + } + } + expect(spec.isBidRequestValid(bidRequest)).to.equal(false); + }) }); describe('spec.buildRequests', function () { @@ -176,7 +220,7 @@ describe('OneVideoBidAdapter', function () { expect(bidResponse.length).to.equal(0); }); - it('should return a valid bid response with just "adm"', function () { + it('should return a valid video bid response with just "adm"', function () { const serverResponse = {seatbid: [{bid: [{id: 1, adid: 123, crid: 2, price: 6.01, adm: ''}]}], cur: 'USD'}; const bidResponse = spec.interpretResponse({ body: serverResponse }, { bidRequest }); let o = { @@ -197,6 +241,26 @@ describe('OneVideoBidAdapter', function () { }; expect(bidResponse).to.deep.equal(o); }); + // @abrowning14 check that banner DAP response is appended to o.ad + mediaType: 'banner' + it('should return a valid DAP banner bid-response', function () { + bidRequest = { + mediaTypes: { + banner: { + sizes: [640, 480] + } + }, + params: { + video: { + display: 1 + } + } + } + const serverResponse = {seatbid: [{bid: [{id: 1, adid: 123, crid: 2, price: 6.01, adm: '
DAP UNIT HERE
'}]}], cur: 'USD'}; + const bidResponse = spec.interpretResponse({ body: serverResponse }, { bidRequest }); + expect(bidResponse.ad).to.equal('
DAP UNIT HERE
'); + expect(bidResponse.mediaType).to.equal('banner'); + expect(bidResponse.renderer).to.equal('undefined'); + }); }); describe('when GDPR and uspConsent applies', function () { @@ -267,7 +331,7 @@ describe('OneVideoBidAdapter', function () { }); }); describe('should send banner object', function () { - it('should send banner object when display is 1', function () { + it('should send banner object when display is 1 and context="instream" (DAP O&O)', function () { bidRequest = { mediaTypes: { video: { @@ -320,7 +384,7 @@ describe('OneVideoBidAdapter', function () { expect(data.imp[0].banner.ext.maxduration).to.equal(bidRequest.params.video.maxduration); expect(data.site.id).to.equal(bidRequest.params.site.id); }); - it('should send video object when display is other than 1', function () { + it('should send video object when display is other than 1 (VAST for All)', function () { bidRequest = { mediaTypes: { video: { @@ -365,7 +429,7 @@ describe('OneVideoBidAdapter', function () { expect(data.imp[0].video.pos).to.equal(position); expect(data.imp[0].video.mimes).to.equal(bidRequest.params.video.mimes); }); - it('should send video object when display is not passed', function () { + it('should send video object when display is not passed (VAST for All)', function () { bidRequest = { mediaTypes: { video: { From 8a15a18dc01d7e0e9e422cf9fd2ebf1c7883328f Mon Sep 17 00:00:00 2001 From: abrowning14 Date: Thu, 7 May 2020 10:33:51 +0300 Subject: [PATCH 5/9] Updated DAP tests - video and banner validations --- test/spec/modules/oneVideoBidAdapter_spec.js | 28 +++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/test/spec/modules/oneVideoBidAdapter_spec.js b/test/spec/modules/oneVideoBidAdapter_spec.js index f806d5c5b2f..45d59683942 100644 --- a/test/spec/modules/oneVideoBidAdapter_spec.js +++ b/test/spec/modules/oneVideoBidAdapter_spec.js @@ -134,12 +134,34 @@ describe('OneVideoBidAdapter', function () { sizes: [640, 480] } }, + bidder: 'oneVideo', + sizes: [640, 480], + bidId: '30b3efwfwe1e', + adUnitCode: 'video1', params: { video: { + playerWidth: 640, + playerHeight: 480, + mimes: ['video/mp4', 'application/javascript'], + protocols: [2, 5], + api: [2], + position: 1, + delivery: [2], + playbackmethod: [1, 5], + sid: 134, + rewarded: 1, + placement: 1, + inventoryid: 123, display: 1 - } + }, + site: { + id: 1, + page: 'https://news.yahoo.com/portfolios', + referrer: 'http://www.yahoo.com' + }, + pubId: 'brxd' } - } + }; expect(spec.isBidRequestValid(bidRequest)).to.equal(true); }) @@ -259,7 +281,7 @@ describe('OneVideoBidAdapter', function () { const bidResponse = spec.interpretResponse({ body: serverResponse }, { bidRequest }); expect(bidResponse.ad).to.equal('
DAP UNIT HERE
'); expect(bidResponse.mediaType).to.equal('banner'); - expect(bidResponse.renderer).to.equal('undefined'); + expect(bidResponse.renderer).to.be.undefined; }); }); From abb20ab0b7942d8a3f362374ca1845b0265b9487 Mon Sep 17 00:00:00 2001 From: abrowning14 Date: Thu, 7 May 2020 11:03:50 +0300 Subject: [PATCH 6/9] updated adapter examples .md file --- modules/oneVideoBidAdapter.js | 10 +- modules/oneVideoBidAdapter.md | 217 +++++++++++++++++++++++----------- 2 files changed, 156 insertions(+), 71 deletions(-) diff --git a/modules/oneVideoBidAdapter.js b/modules/oneVideoBidAdapter.js index 2d9989089b6..94aa1403b2a 100644 --- a/modules/oneVideoBidAdapter.js +++ b/modules/oneVideoBidAdapter.js @@ -21,12 +21,18 @@ export const spec = { } // Video validations - if (typeof bid.params.video === 'undefined' || typeof bid.params.video.playerWidth === 'undefined' || typeof bid.params.video.playerHeight == 'undefined' || typeof bid.params.video.mimes == 'undefined' || (bid.mediaTypes.video.context === 'outstream' && bid.params.video.display === 1)) { + if (typeof bid.params.video === 'undefined' || typeof bid.params.video.playerWidth === 'undefined' || typeof bid.params.video.playerHeight == 'undefined' || typeof bid.params.video.mimes == 'undefined') { return false; } + // Prevend DAP Outstream validation + if (bid.mediaTypes.video) { + if (bid.mediaTypes.video.context === 'outstream' && bid.params.video.display === 1) { + return false; + } + } // Banner DAP validation - if (bid.mediaTypes.banner && typeof bid.params.video.display === 'undefined') { + if (bid.mediaTypes.banner && (typeof bid.params.video.display === 'undefined' || !bid.params.video.display)) { return false; } diff --git a/modules/oneVideoBidAdapter.md b/modules/oneVideoBidAdapter.md index 656f81733a0..1805a6869d3 100644 --- a/modules/oneVideoBidAdapter.md +++ b/modules/oneVideoBidAdapter.md @@ -1,89 +1,168 @@ # Overview **Module Name**: One Video Bidder Adapter -**Module Type**: Bidder Adapter +**Module Type**: Bidder Adapter **Maintainer**: deepthi.neeladri.sravana@verizonmedia.com # Description -Connects to One Video demand source to fetch bids. +Connects to Verizon Media's Video SSP (AKA ONE Video / Adap.tv) demand source to fetch bids. -# Test Parameters for Video +# Instream Video adUnit example & parameters +*Note:* The Video SSP ad server will respond with an VAST XML to load into your defined player. +``` + var adUnits = [ + { + code: 'video1', + mediaTypes: { + video: { + context: 'instream', + playerSize: [480, 640] + } + }, + bids: [ + { + bidder: 'oneVideo', + params: { + video: { + playerWidth: 480, + playerHeight: 640, + mimes: ['video/mp4', 'application/javascript'], + protocols: [2,5], + api: [2], + position: 1, + delivery: [2], + playbackmethod: [1,5], + sid: , + rewarded: 1, + placement: 1, + inventoryid: 123, + minduration: 10, + maxduration: 30, + }, + site: { + id: 1, + page: 'https://verizonmedia.com', + referrer: 'https://verizonmedia.com' + }, + pubId: 'HBExchange' + } + } + ] + } + ] +``` +# Outstream Video adUnit example & parameters +*Note:* The Video SSP ad server will load it's own Outstream Renderer (player) as a fallback if no player is defined on the publisher page. The Outstream player will inject into the div id that has an identical adUnit code. +``` + var adUnits = [ + { + code: 'video1', + mediaTypes: { + video: { + context: 'outstream', + playerSize: [480, 640] + } + }, + bids: [ + { + bidder: 'oneVideo', + params: { + video: { + playerWidth: 480, + playerHeight: 640, + mimes: ['video/mp4', 'application/javascript'], + protocols: [2,5], + api: [2], + position: 1, + delivery: [2], + playbackmethod: [1,5], + sid: , + rewarded: 1, + placement: 1, + inventoryid: 123, + minduration: 10, + maxduration: 30, + }, + site: { + id: 1, + page: 'https://verizonmedia.com', + referrer: 'https://verizonmedia.com' + }, + pubId: 'HBExchange' + } + } + ] + } + ] ``` - var adUnits = [ - { +# S2S / Video: Dynamic Ad Placement (DAP) adUnit example & parameters +*Note:* The Video SSP ad server will respond with HTML embed tag to be injected into an iFrame you create. +``` + var adUnits = [ + { code: 'video1', - sizes: [640,480], - mediaTypes: { - video: { - context: "instream" + mediaTypes: { + video: { + context: "instream", + playerSize: [480, 640] + } + }, + bids: [ + { + bidder: 'oneVideo', + params: { + video: { + playerWidth: 480, + playerHeight: 640, + mimes: ['video/mp4', 'application/javascript'], + position: 1, + display: 1 + }, + site: { + id: 1, + page: 'https://verizonmedia.com', + referrer: 'https://verizonmedia.com' + }, + pubId: 'HBExchangeDAP' } - }, - bids: [ - { - bidder: 'oneVideo', - params: { - video: { - playerWidth: 480, - playerHeight: 640, - mimes: ['video/mp4', 'application/javascript'], - protocols: [2,5], - api: [2], - position: 1, - delivery: [2], - playbackmethod: [1,5], - sid: , - rewarded: 1, - placement: 1, - inventoryid: 123, - minduration: 10, - maxduration: 30, - }, - site: { - id: 1, - page: 'http://abhi12345.com', - referrer: 'http://abhi12345.com' - }, - pubId: 'brxd' - } - } - ] + } + ] } ] ``` -# Test Parameters for banner request +# Prebid.js / Banner: Dynamic Ad Placement (DAP) adUnit example & parameters +*Note:* The Video SSP ad server will respond with HTML embed tag to be injected into an iFrame created by Google Ad Manager (GAM). ``` - var adUnits = [ + var adUnits = [ + { + code: 'banner-1', + mediaTypes: { + banner: { + sizes: [300, 250] + } + }, + bids: [ { - code: 'video1', - sizes: [640,480], - mediaTypes: { - video: { - context: "instream" - } - }, - bids: [ - { - bidder: 'oneVideo', - params: { - video: { - playerWidth: 480, - playerHeight: 640, - mimes: ['video/mp4', 'application/javascript'], - position: 1, - display: 1 - }, - site: { - id: 1, - page: 'http://abhi12345.com', - referrer: 'http://abhi12345.com' - }, - pubId: 'OneMDisplay' - } - } - ] - } + bidder: 'oneVideo', + params: { + video: { + playerWidth: 300, + playerHeight: 250, + mimes: ['video/mp4', 'application/javascript'], + display: 1 + }, + site: { + id: 1, + page: 'https://verizonmedia.com', + referrer: 'https://verizonmedia.com' + }, + pubId: 'HBExchangeDAP' + } + } + ] + } ] ``` From aeea0b6c1ba2503ccfb6a17296a1c577ddc3c3bf Mon Sep 17 00:00:00 2001 From: abrowning14 Date: Thu, 7 May 2020 12:02:54 +0300 Subject: [PATCH 7/9] Updated ternary operator for bidResponse.mediaType setting --- modules/oneVideoBidAdapter.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/modules/oneVideoBidAdapter.js b/modules/oneVideoBidAdapter.js index 94aa1403b2a..b75226456ac 100644 --- a/modules/oneVideoBidAdapter.js +++ b/modules/oneVideoBidAdapter.js @@ -99,11 +99,7 @@ export const spec = { adUnitCode: bidRequest.adUnitCode }; - if (bidRequest.mediaTypes.banner) { - bidResponse.mediaType = 'banner' - } else { - bidResponse.mediaType = 'video' - } + bidResponse.mediaType = (bidRequest.mediaTypes.banner) ? 'banner' : 'video' if (bid.nurl) { bidResponse.vastUrl = bid.nurl; From 331ab546b3a7d3416467bf53c58a49bc6c852867 Mon Sep 17 00:00:00 2001 From: abrowning14 Date: Sat, 16 May 2020 15:16:37 +0300 Subject: [PATCH 8/9] removing redundant display parameter validation --- modules/oneVideoBidAdapter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/oneVideoBidAdapter.js b/modules/oneVideoBidAdapter.js index b75226456ac..e43e7eff0f8 100644 --- a/modules/oneVideoBidAdapter.js +++ b/modules/oneVideoBidAdapter.js @@ -32,7 +32,7 @@ export const spec = { } } // Banner DAP validation - if (bid.mediaTypes.banner && (typeof bid.params.video.display === 'undefined' || !bid.params.video.display)) { + if (bid.mediaTypes.banner && (!bid.params.video.display)) { return false; } From bf53842aaaee356f5933bb7ad6ae346f449c2dca Mon Sep 17 00:00:00 2001 From: Adam Browning <19834421+adam-browning@users.noreply.github.com> Date: Mon, 18 May 2020 12:12:45 +0300 Subject: [PATCH 9/9] Update package-lock.json --- package-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index b325e77745c..e8387d41383 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "prebid.js", - "version": "3.19.0-pre", + "version": "3.18.0-pre", "lockfileVersion": 1, "requires": true, "dependencies": {