From ec080971f83e2a08bf93162d07942f909eb2022b Mon Sep 17 00:00:00 2001 From: Patrick McCann Date: Thu, 6 Apr 2023 10:37:34 -0400 Subject: [PATCH] TTD Bid Adapter: add support for video.plcmt and imp.rwdd (#9762) * Update ttdBidAdapter.js * Update ttdBidAdapter_spec.js * Update ttdBidAdapter_spec.js * Update ttdBidAdapter_spec.js * Update ttdBidAdapter_spec.js * Update ttdBidAdapter.js * Update ttdBidAdapter_spec.js --- modules/ttdBidAdapter.js | 11 +++++++++-- test/spec/modules/ttdBidAdapter_spec.js | 23 +++++++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/modules/ttdBidAdapter.js b/modules/ttdBidAdapter.js index db166577d82..b9e209f7cd7 100644 --- a/modules/ttdBidAdapter.js +++ b/modules/ttdBidAdapter.js @@ -164,15 +164,18 @@ function getImpression(bidRequest) { const gpid = utils.deepAccess(bidRequest, 'ortb2Imp.ext.gpid'); const tid = utils.deepAccess(bidRequest, 'ortb2Imp.ext.tid'); + const rwdd = utils.deepAccess(bidRequest, 'ortb2Imp.rwdd'); if (gpid || tid) { impression.ext = {} if (gpid) { impression.ext.gpid = gpid } if (tid) { impression.ext.tid = tid } } - + if (rwdd) { + impression.rwdd = rwdd; + } const tagid = gpid || bidRequest.params.placementId; if (tagid) { - impression.tagid = tagid + impression.tagid = tagid; } const mediaTypesVideo = utils.deepAccess(bidRequest, 'mediaTypes.video'); @@ -251,6 +254,7 @@ function video(bid) { const api = utils.deepAccess(bid, 'mediaTypes.video.api'); const mimes = utils.deepAccess(bid, 'mediaTypes.video.mimes'); const placement = utils.deepAccess(bid, 'mediaTypes.video.placement'); + const plcmt = utils.deepAccess(bid, 'mediaTypes.video.plcmt'); const protocols = utils.deepAccess(bid, 'mediaTypes.video.protocols'); const playbackmethod = utils.deepAccess(bid, 'mediaTypes.video.playbackmethod'); const pos = utils.deepAccess(bid, 'mediaTypes.video.pos'); @@ -286,6 +290,9 @@ function video(bid) { if (playbackmethod) { video.playbackmethod = playbackmethod; } + if (plcmt) { + video.plcmt = plcmt; + } if (pos) { video.pos = pos; } diff --git a/test/spec/modules/ttdBidAdapter_spec.js b/test/spec/modules/ttdBidAdapter_spec.js index f9adecabddf..8c0a9db8fbd 100644 --- a/test/spec/modules/ttdBidAdapter_spec.js +++ b/test/spec/modules/ttdBidAdapter_spec.js @@ -282,6 +282,21 @@ describe('ttdBidAdapter', function () { expect(requestBody.imp[0].ext.gpid).to.equal(gpid); }); + it('sends rwdd in imp.rwdd if present', function () { + let clonedBannerRequests = deepClone(baseBannerBidRequests); + const gpid = '/1111/home#header'; + const rwdd = 1; + clonedBannerRequests[0].ortb2Imp = { + rwdd: rwdd, + ext: { + gpid: gpid + } + }; + const requestBody = testBuildRequests(clonedBannerRequests, baseBidderRequest).data; + expect(requestBody.imp[0].rwdd).to.be.not.null; + expect(requestBody.imp[0].rwdd).to.equal(1); + }); + it('sends auction id in source.tid', function () { const requestBody = testBuildRequests(baseBannerBidRequests, baseBidderRequest).data; expect(requestBody.source).to.be.not.null; @@ -877,6 +892,14 @@ describe('ttdBidAdapter', function () { const requestBody = testBuildRequests(clonedVideoRequests, baseBidderRequest).data; expect(requestBody.imp[0].video.placement).to.equal(3); }); + + it('sets plcmt correctly if sent', function () { + let clonedVideoRequests = deepClone(baseVideoBidRequests); + clonedVideoRequests[0].mediaTypes.video.plcmt = 3; + + const requestBody = testBuildRequests(clonedVideoRequests, baseBidderRequest).data; + expect(requestBody.imp[0].video.plcmt).to.equal(3); + }); }); describe('interpretResponse-empty', function () {