From 5e8c79ad68bed34a1fb7f44f82b5a7cf52a476cc Mon Sep 17 00:00:00 2001 From: shahinrahbariasl <56240400+shahinrahbariasl@users.noreply.github.com> Date: Fri, 8 Jul 2022 14:47:10 -0400 Subject: [PATCH] IX Bid Adapter: Add support for impression level transactionId (imp[].ext.tid) (#8641) * IX Bid Adapter: add imp ext tid support * fix tid level in imp ext object Co-authored-by: shahin.rahbariasl --- modules/ixBidAdapter.js | 6 +++- test/spec/modules/ixBidAdapter_spec.js | 41 ++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/modules/ixBidAdapter.js b/modules/ixBidAdapter.js index 3076dbb6436..c22c0af7f4d 100644 --- a/modules/ixBidAdapter.js +++ b/modules/ixBidAdapter.js @@ -1050,6 +1050,7 @@ function buildRequest(validBidRequests, bidderRequest, impressions, version) { const gpid = impressions[transactionIds[adUnitIndex]].gpid; const dfpAdUnitCode = impressions[transactionIds[adUnitIndex]].dfp_ad_unit_code; + const tid = impressions[transactionIds[adUnitIndex]].tid if (impressionObjects.length && BANNER in impressionObjects[0]) { const { id, banner: { topframe } } = impressionObjects[0]; const _bannerImpression = { @@ -1060,10 +1061,11 @@ function buildRequest(validBidRequests, bidderRequest, impressions, version) { }, } - if (dfpAdUnitCode || gpid) { + if (dfpAdUnitCode || gpid || tid) { _bannerImpression.ext = {}; _bannerImpression.ext.dfp_ad_unit_code = dfpAdUnitCode; _bannerImpression.ext.gpid = gpid; + _bannerImpression.ext.tid = tid; } if ('bidfloor' in impressionObjects[0]) { @@ -1272,6 +1274,7 @@ function createVideoImps(validBidRequest, videoImps) { videoImps[validBidRequest.transactionId].ixImps = []; videoImps[validBidRequest.transactionId].ixImps.push(imp); videoImps[validBidRequest.transactionId].gpid = deepAccess(validBidRequest, 'ortb2Imp.ext.gpid'); + videoImps[validBidRequest.transactionId].tid = deepAccess(validBidRequest, 'ortb2Imp.ext.tid'); } } @@ -1298,6 +1301,7 @@ function createBannerImps(validBidRequest, missingBannerSizes, bannerImps) { bannerImps[validBidRequest.transactionId].gpid = deepAccess(validBidRequest, 'ortb2Imp.ext.gpid'); bannerImps[validBidRequest.transactionId].dfp_ad_unit_code = deepAccess(validBidRequest, 'ortb2Imp.ext.data.adserver.adslot'); + bannerImps[validBidRequest.transactionId].tid = deepAccess(validBidRequest, 'ortb2Imp.ext.tid'); // Create IX imps from params.size if (bannerSizeDefined) { diff --git a/test/spec/modules/ixBidAdapter_spec.js b/test/spec/modules/ixBidAdapter_spec.js index a79b73d34e2..233fac6f426 100644 --- a/test/spec/modules/ixBidAdapter_spec.js +++ b/test/spec/modules/ixBidAdapter_spec.js @@ -121,6 +121,11 @@ describe('IndexexchangeAdapter', function () { playerSize: [[400, 100]] } }, + ortb2Imp: { + ext: { + tid: '173f49a8-7549-4218-a23c-e7ba59b47230' + } + }, adUnitCode: 'div-gpt-ad-1460505748562-0', transactionId: '173f49a8-7549-4218-a23c-e7ba59b47230', bidId: '1a2b3c4e', @@ -143,6 +148,11 @@ describe('IndexexchangeAdapter', function () { sizes: [[300, 250]] } }, + ortb2Imp: { + ext: { + tid: '173f49a8-7549-4218-a23c-e7ba59b47229' + } + }, adUnitCode: 'div-gpt-ad-1460505748561-0', transactionId: '173f49a8-7549-4218-a23c-e7ba59b47229', bidId: '1a2b3c4d', @@ -165,6 +175,11 @@ describe('IndexexchangeAdapter', function () { sizes: [[300, 250], [300, 600]] } }, + ortb2Imp: { + ext: { + tid: '173f49a8-7549-4218-a23c-e7ba59b47229' + } + }, adUnitCode: 'div-gpt-ad-1460505748561-0', transactionId: '173f49a8-7549-4218-a23c-e7ba59b47229', bidId: '1a2b3c4d', @@ -185,6 +200,11 @@ describe('IndexexchangeAdapter', function () { sizes: [[300, 250], [300, 600]] } }, + ortb2Imp: { + ext: { + tid: '173f49a8-7549-4218-a23c-e7ba59b47229' + } + }, adUnitCode: 'div-gpt-ad-1460505748561-0', transactionId: '173f49a8-7549-4218-a23c-e7ba59b47229', bidId: '1a2b3c4d', @@ -214,6 +234,11 @@ describe('IndexexchangeAdapter', function () { protocols: [2] } }, + ortb2Imp: { + ext: { + tid: '173f49a8-7549-4218-a23c-e7ba59b47230' + } + }, adUnitCode: 'div-gpt-ad-1460505748562-0', transactionId: '173f49a8-7549-4218-a23c-e7ba59b47230', bidId: '1a2b3c4e', @@ -247,6 +272,11 @@ describe('IndexexchangeAdapter', function () { playerSize: [[400, 100], [200, 400]] } }, + ortb2Imp: { + ext: { + tid: '173f49a8-7549-4218-a23c-e7ba59b47230' + } + }, adUnitCode: 'div-gpt-ad-1460505748562-0', transactionId: '173f49a8-7549-4218-a23c-e7ba59b47230', bidId: '1a2b3c4e', @@ -272,6 +302,11 @@ describe('IndexexchangeAdapter', function () { sizes: [[300, 250], [300, 600], [400, 500]] } }, + ortb2Imp: { + ext: { + tid: '173f49a8-7549-4218-a23c-e7ba59b47230' + } + }, adUnitCode: 'div-gpt-ad-1460505748562-0', transactionId: '173f49a8-7549-4218-a23c-e7ba59b47230', bidId: '1a2b3c4e', @@ -307,6 +342,11 @@ describe('IndexexchangeAdapter', function () { sizes: [[300, 250], [300, 600]] } }, + ortb2Imp: { + ext: { + tid: '173f49a8-7549-4218-a23c-e7ba59b47230' + } + }, adUnitCode: 'div-gpt-ad-1460505748562-0', transactionId: '273f49a8-7549-4218-a23c-e7ba59b47230', bidId: '1a2b3c4e', @@ -1720,6 +1760,7 @@ describe('IndexexchangeAdapter', function () { expect(impression.id).to.equal(DEFAULT_BANNER_VALID_BID[0].bidId); expect(impression.banner.format).to.be.length(2); expect(impression.banner.topframe).to.be.oneOf([0, 1]); + expect(impression.ext.tid).to.equal(DEFAULT_BANNER_VALID_BID[0].transactionId); impression.banner.format.map(({ w, h, ext }, index) => { const size = DEFAULT_BANNER_VALID_BID[0].mediaTypes.banner.sizes[index];