Skip to content

IX Bid Adapter: Add support for impression level transactionId (imp[].ext.tid) #8641

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion modules/ixBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,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 = {
Expand All @@ -708,10 +709,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]) {
Expand Down Expand Up @@ -904,6 +906,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');
}
}

Expand All @@ -930,6 +933,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) {
Expand Down
41 changes: 41 additions & 0 deletions test/spec/modules/ixBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,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',
Expand All @@ -142,6 +147,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',
Expand All @@ -164,6 +174,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',
Expand All @@ -184,6 +199,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',
Expand Down Expand Up @@ -213,6 +233,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',
Expand Down Expand Up @@ -246,6 +271,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',
Expand All @@ -271,6 +301,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',
Expand Down Expand Up @@ -306,6 +341,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',
Expand Down Expand Up @@ -1500,6 +1540,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];
Expand Down