Skip to content

Commit d23c0c6

Browse files
umakajanChris Pabst
authored and
Chris Pabst
committed
move dfp_ad_unit_code to imp.ext (prebid#7637)
1 parent 3a1ad21 commit d23c0c6

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

modules/ixBidAdapter.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ function buildRequest(validBidRequests, bidderRequest, impressions, version) {
646646
}
647647

648648
if (impressionObjects.length && BANNER in impressionObjects[0]) {
649-
const { id, banner: { topframe } } = impressionObjects[0];
649+
const { id, banner: { topframe }, ext } = impressionObjects[0];
650650
const _bannerImpression = {
651651
id,
652652
banner: {
@@ -655,6 +655,12 @@ function buildRequest(validBidRequests, bidderRequest, impressions, version) {
655655
},
656656
}
657657

658+
if (ext.dfp_ad_unit_code) {
659+
_bannerImpression.ext = {
660+
dfp_ad_unit_code: ext.dfp_ad_unit_code
661+
}
662+
}
663+
658664
if ('bidfloor' in impressionObjects[0]) {
659665
_bannerImpression.bidfloor = impressionObjects[0].bidfloor;
660666
}

test/spec/modules/ixBidAdapter_spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,16 +1405,16 @@ describe('IndexexchangeAdapter', function () {
14051405
}
14061406
};
14071407
const requests = spec.buildRequests(validBids, DEFAULT_OPTION);
1408-
const { dfp_ad_unit_code } = JSON.parse(requests[0].data.r).imp[0].banner.format[0].ext;
1408+
const { ext: { dfp_ad_unit_code } } = JSON.parse(requests[0].data.r).imp[0];
14091409
expect(dfp_ad_unit_code).to.equal(AD_UNIT_CODE);
14101410
});
14111411

14121412
it('should not send dfp_adunit_code in request if ortb2Imp.ext.data.adserver.adslot does not exists', function () {
14131413
const validBids = utils.deepClone(DEFAULT_BANNER_VALID_BID);
14141414
const requests = spec.buildRequests(validBids, DEFAULT_OPTION);
1415-
const { dfp_ad_unit_code } = JSON.parse(requests[0].data.r).imp[0].banner.format[0].ext;
1415+
const { ext } = JSON.parse(requests[0].data.r).imp[0];
14161416

1417-
expect(dfp_ad_unit_code).to.not.exist;
1417+
expect(ext).to.not.exist;
14181418
});
14191419

14201420
it('payload should have correct format and value', function () {

0 commit comments

Comments
 (0)