diff --git a/modules/ixBidAdapter.js b/modules/ixBidAdapter.js index c22c0af7f4d..136cf6f25f0 100644 --- a/modules/ixBidAdapter.js +++ b/modules/ixBidAdapter.js @@ -244,6 +244,8 @@ function bidToVideoImp(bid) { } imp.video = videoParamRef ? deepClone(bid.params.video) : {}; + // populate imp level transactionId + imp.ext.tid = deepAccess(bid, 'ortb2Imp.ext.tid'); // copy all video properties to imp object for (const adUnitProperty in videoAdUnitRef) { @@ -355,6 +357,9 @@ function bidToNativeImp(bid) { ver: '1.2' }; + // populate imp level transactionId + imp.ext.tid = deepAccess(bid, 'ortb2Imp.ext.tid'); + _applyFloor(bid, imp, NATIVE); return imp; @@ -1126,6 +1131,22 @@ function buildRequest(validBidRequests, bidderRequest, impressions, version) { } } + // add identifiers info to ixDiag + const pbaAdSlot = impressions[transactionIds[adUnitIndex]].pbadslot + const tagId = impressions[transactionIds[adUnitIndex]].tagId + const adUnitCode = impressions[transactionIds[adUnitIndex]].adUnitCode + const divId = impressions[transactionIds[adUnitIndex]].divId + if (pbaAdSlot || tagId || adUnitCode || divId) { + const clonedRObject = deepClone(r); + const requestSize = `${baseUrl}${parseQueryStringParameters({ ...payload, r: JSON.stringify(clonedRObject) })}`.length; + if (requestSize < MAX_REQUEST_SIZE) { + r.ext.ixdiag.pbadslot = pbaAdSlot; + r.ext.ixdiag.tagid = tagId; + r.ext.ixdiag.adunitcode = adUnitCode; + r.ext.ixdiag.divId = divId; + } + } + const isLastAdUnit = adUnitIndex === transactionIds.length - 1; if (wasAdUnitImpressionsTrimmed || isLastAdUnit) { @@ -1259,6 +1280,13 @@ function createNativeImps(validBidRequest, nativeImps) { nativeImps[validBidRequest.transactionId].ixImps = []; nativeImps[validBidRequest.transactionId].ixImps.push(imp); nativeImps[validBidRequest.transactionId].gpid = deepAccess(validBidRequest, 'ortb2Imp.ext.gpid') + nativeImps[validBidRequest.transactionId].pbadslot = deepAccess(validBidRequest, 'ortb2Imp.ext.data.pbadslot'); + nativeImps[validBidRequest.transactionId].tagId = deepAccess(validBidRequest, 'params.tagId'); + + const adUnitCode = validBidRequest.adUnitCode; + const divId = document.getElementById(adUnitCode) ? adUnitCode : getGptSlotInfoForAdUnitCode(adUnitCode).divId; + nativeImps[validBidRequest.transactionId].adUnitCode = adUnitCode; + nativeImps[validBidRequest.transactionId].divId = divId; } } @@ -1274,7 +1302,13 @@ 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'); + videoImps[validBidRequest.transactionId].pbadslot = deepAccess(validBidRequest, 'ortb2Imp.ext.data.pbadslot'); + videoImps[validBidRequest.transactionId].tagId = deepAccess(validBidRequest, 'params.tagId'); + + const adUnitCode = validBidRequest.adUnitCode; + const divId = document.getElementById(adUnitCode) ? adUnitCode : getGptSlotInfoForAdUnitCode(adUnitCode).divId; + videoImps[validBidRequest.transactionId].adUnitCode = adUnitCode; + videoImps[validBidRequest.transactionId].divId = divId; } } @@ -1302,6 +1336,13 @@ 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'); + bannerImps[validBidRequest.transactionId].pbadslot = deepAccess(validBidRequest, 'ortb2Imp.ext.data.pbadslot'); + bannerImps[validBidRequest.transactionId].tagId = deepAccess(validBidRequest, 'params.tagId'); + + const adUnitCode = validBidRequest.adUnitCode; + const divId = document.getElementById(adUnitCode) ? adUnitCode : getGptSlotInfoForAdUnitCode(adUnitCode).divId; + bannerImps[validBidRequest.transactionId].adUnitCode = adUnitCode; + bannerImps[validBidRequest.transactionId].divId = divId; // 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 233fac6f426..a25e6b1c6a0 100644 --- a/test/spec/modules/ixBidAdapter_spec.js +++ b/test/spec/modules/ixBidAdapter_spec.js @@ -290,6 +290,7 @@ describe('IndexexchangeAdapter', function () { { bidder: 'ix', params: { + tagId: '123', siteId: '123', size: [300, 250], }, @@ -304,7 +305,10 @@ describe('IndexexchangeAdapter', function () { }, ortb2Imp: { ext: { - tid: '173f49a8-7549-4218-a23c-e7ba59b47230' + tid: '173f49a8-7549-4218-a23c-e7ba59b47230', + data: { + pbadslot: 'div-gpt-ad-1460505748562-0' + } } }, adUnitCode: 'div-gpt-ad-1460505748562-0', @@ -320,6 +324,7 @@ describe('IndexexchangeAdapter', function () { { bidder: 'ix', params: { + tagId: '123', siteId: '456', video: { skippable: false, @@ -344,7 +349,10 @@ describe('IndexexchangeAdapter', function () { }, ortb2Imp: { ext: { - tid: '173f49a8-7549-4218-a23c-e7ba59b47230' + tid: '173f49a8-7549-4218-a23c-e7ba59b47230', + data: { + pbadslot: 'div-gpt-ad-1460505748562-0' + } } }, adUnitCode: 'div-gpt-ad-1460505748562-0', @@ -2614,6 +2622,9 @@ describe('IndexexchangeAdapter', function () { expect(diagObj.allu).to.equal(2); expect(diagObj.version).to.equal('$prebid.version$'); expect(diagObj.url).to.equal('http://localhost:9876/context.html') + expect(diagObj.pbadslot).to.equal(DEFAULT_MULTIFORMAT_VIDEO_VALID_BID[0].ortb2Imp.ext.data.pbadslot) + expect(diagObj.tagid).to.equal(DEFAULT_MULTIFORMAT_VIDEO_VALID_BID[0].params.tagId) + expect(diagObj.adunitcode).to.equal(DEFAULT_MULTIFORMAT_VIDEO_VALID_BID[0].adUnitCode) }); }); });