diff --git a/modules/impactifyBidAdapter.js b/modules/impactifyBidAdapter.js index 633c92a774d..0307e26ac7e 100644 --- a/modules/impactifyBidAdapter.js +++ b/modules/impactifyBidAdapter.js @@ -403,6 +403,18 @@ export const spec = { .filter((bid) => bid.price > 0) .map((bid) => { const isPlayer = impMap[bid.impid]?.ext?.impactify?.format === 'player'; + const isVideo = !!impMap[bid.impid]?.video; + let mediaType; + if (bid?.mtype === 2) { + mediaType = 'video'; + } else if (bid?.mtype === 1) { + mediaType = 'banner'; + } else if (isPlayer || isVideo) { + mediaType = 'video'; + } else { + mediaType = 'banner'; + } + return { id: bid.id, requestId: bid.impid, @@ -413,6 +425,7 @@ export const spec = { height: bid.h || 0, ttl: 300, creativeId: bid.crid || 0, + mediaType: mediaType, meta: { advertiserDomains: bid.adomain && bid.adomain.length ? bid.adomain : [], @@ -420,7 +433,6 @@ export const spec = { ...(isPlayer ? { - mediaType: "video", vastUrl: bid.ext?.vast_url, vastXml: bid.adm, } diff --git a/test/spec/modules/impactifyBidAdapter_spec.js b/test/spec/modules/impactifyBidAdapter_spec.js index a977361ea76..ee641f29ac3 100644 --- a/test/spec/modules/impactifyBidAdapter_spec.js +++ b/test/spec/modules/impactifyBidAdapter_spec.js @@ -336,6 +336,7 @@ describe('ImpactifyAdapter', function () { id: '65820304700829014', impid: '462c08f20d428', price: 3.40, + mtype: 2, adm: '', adid: '97517771', iurl: 'https://fra1-ib.adnxs.com/cr?id=97517771', @@ -343,10 +344,10 @@ describe('ImpactifyAdapter', function () { crid: '97517771', w: 1, h: 1, - meta: { 'advertiserDomains': ['testdomain.com'] }, + adomain: ['testdomain.com'], ext: { prebid: { - 'type': 'video' + type: 'video' }, bidder: { prebid: { @@ -406,7 +407,8 @@ describe('ImpactifyAdapter', function () { } }, ] - } + }; + const expectedResponse = [ { id: '65820304700829014', @@ -417,7 +419,8 @@ describe('ImpactifyAdapter', function () { ad: '', width: 1, height: 1, - meta: { 'advertiserDomains': ['testdomain.com'] }, + mediaType: 'video', + meta: { advertiserDomains: ['testdomain.com'] }, ttl: 300, creativeId: '97517771' } @@ -448,6 +451,7 @@ describe('ImpactifyAdapter', function () { id: 'bid-1', impid: 'imp-1', price: 2.5, + mtype: 2, ext: { vast_url: 'https://example.com/vast.xml' }, @@ -467,6 +471,51 @@ describe('ImpactifyAdapter', function () { expect(result[0].vastXml).to.equal('fallback'); expect(result[0]).to.not.have.property('ad'); }); + + it('should map banner responses to banner bids', function () { + const bidRequest = { + data: JSON.stringify({ + imp: [{ + id: 'imp-banner-1', + ext: { + impactify: { + format: 'display' + } + } + }] + }) + }; + + const serverResponse = { + body: { + cur: 'USD', + seatbid: [{ + bid: [{ + id: 'bid-banner-1', + impid: 'imp-banner-1', + price: 1.75, + mtype: 1, + adm: '
banner creative
', + crid: 'creative-banner-1', + w: 300, + h: 250, + adomain: ['advertiser.com'] + }] + }] + } + }; + + const result = spec.interpretResponse(serverResponse, bidRequest); + + expect(result).to.have.length(1); + expect(result[0].mediaType).to.equal('banner'); + expect(result[0].ad).to.equal('
banner creative
'); + expect(result[0]).to.not.have.property('vastUrl'); + expect(result[0]).to.not.have.property('vastXml'); + expect(result[0].meta).to.deep.equal({ + advertiserDomains: ['advertiser.com'] + }); + }); }); describe('getUserSyncs', function () { const videoBidRequests = [