From 8c48167b87f83309cad3b38bf71f26e750194e3e Mon Sep 17 00:00:00 2001 From: Geoffray Date: Fri, 1 Dec 2023 16:01:13 +0100 Subject: [PATCH 1/2] SparteoBidAdapter: handle vastUrl for video context --- modules/sparteoBidAdapter.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/modules/sparteoBidAdapter.js b/modules/sparteoBidAdapter.js index ac48ec4089d..ce8ed5c5ad3 100644 --- a/modules/sparteoBidAdapter.js +++ b/modules/sparteoBidAdapter.js @@ -38,7 +38,14 @@ const converter = ortbConverter({ bidResponse(buildBidResponse, bid, context) { context.mediaType = deepAccess(bid, 'ext.prebid.type'); - return buildBidResponse(bid, context) + const response = buildBidResponse(bid, context); + + if (context.mediaType == 'video') { + response.nurl = bid.nurl; + response.vastUrl = deepAccess(bid, 'ext.prebid.cache.vastXml.url'); + } + + return response; } }); @@ -120,10 +127,8 @@ export const spec = { onTimeout: function(timeoutData) {}, onBidWon: function(bid) { - if (bid && bid.nurl && bid.nurl.length > 0) { - bid.nurl.forEach(function(winUrl) { - triggerPixel(winUrl, null); - }); + if (bid && bid.nurl) { + triggerPixel(bid.nurl, null); } }, From 6c6f7d08f8d8eab27b5edc4ffaa8b63626139ee3 Mon Sep 17 00:00:00 2001 From: Geoffray Date: Wed, 6 Dec 2023 16:31:33 +0100 Subject: [PATCH 2/2] Add: video tests --- modules/sparteoBidAdapter.js | 2 +- test/spec/modules/sparteoBidAdapter_spec.js | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/modules/sparteoBidAdapter.js b/modules/sparteoBidAdapter.js index ce8ed5c5ad3..93353c5dda7 100644 --- a/modules/sparteoBidAdapter.js +++ b/modules/sparteoBidAdapter.js @@ -42,7 +42,7 @@ const converter = ortbConverter({ if (context.mediaType == 'video') { response.nurl = bid.nurl; - response.vastUrl = deepAccess(bid, 'ext.prebid.cache.vastXml.url'); + response.vastUrl = deepAccess(bid, 'ext.prebid.cache.vastXml.url') ?? null; } return response; diff --git a/test/spec/modules/sparteoBidAdapter_spec.js b/test/spec/modules/sparteoBidAdapter_spec.js index d6b8b0cc2d8..71191b44a29 100644 --- a/test/spec/modules/sparteoBidAdapter_spec.js +++ b/test/spec/modules/sparteoBidAdapter_spec.js @@ -323,7 +323,12 @@ describe('SparteoAdapter', function () { 'price': 5, 'ext': { 'prebid': { - 'type': 'video' + 'type': 'video', + 'cache': { + 'vastXml': { + 'url': 'https://pbs.tet.com/cache?uuid=1234' + } + } } }, 'adm': 'tag', @@ -368,7 +373,8 @@ describe('SparteoAdapter', function () { ttl: TTL, mediaType: 'video', meta: {}, - vastUrl: 'https://t.bidder.sparteo.com/img', + nurl: 'https://t.bidder.sparteo.com/img', + vastUrl: 'https://pbs.tet.com/cache?uuid=1234', vastXml: 'tag' }); }