diff --git a/modules/ringieraxelspringerBidAdapter.js b/modules/ringieraxelspringerBidAdapter.js index 4fcf07088e0..203e6a99bf6 100644 --- a/modules/ringieraxelspringerBidAdapter.js +++ b/modules/ringieraxelspringerBidAdapter.js @@ -234,7 +234,7 @@ const buildBid = (ad, mediaType) => { height: ad.height || 0 } - if (mediaType === 'native') { + if (ad.type === 'native') { data.meta = { mediaType: NATIVE }; data.mediaType = NATIVE; data.native = parseNativeResponse(ad) || {}; @@ -267,19 +267,22 @@ const getSlots = (bidRequests) => { for (let i = 0; i < batchSize; i++) { const adunit = bidRequests[i]; const slotSequence = deepAccess(adunit, 'params.slotSequence'); - const creFormat = getAdUnitCreFormat(adunit); - const sizes = creFormat === 'native' ? 'fluid' : parseSizesInput(getAdUnitSizes(adunit)).join(','); + const creFormats = getAdUnitCreFormats(adunit); + const sizes = parseSizesInput(getAdUnitSizes(adunit))?.filter(Boolean); + + if (creFormats.includes('native') && sizes?.indexOf('fluid') === -1) { + sizes.push('fluid'); + } queryString += `&slot${i}=${encodeURIComponent(adunit.params.slot)}&id${i}=${encodeURIComponent(adunit.bidId)}&composition${i}=CHILD`; - if (creFormat === 'native') { - queryString += `&cre_format${i}=native`; - } + queryString += `&cre_format${i}=${encodeURIComponent(creFormats.join())}`; - queryString += `&kvhb_format${i}=${creFormat === 'native' ? 'native' : 'banner'}`; + // change 'html' format to 'banner' + queryString += `&kvhb_format${i}=${encodeURIComponent(creFormats.map(format => format === 'html' ? 'banner' : format).join())}`; - if (sizes) { - queryString += `&iusizes${i}=${encodeURIComponent(sizes)}`; + if (Array.isArray(sizes)) { + queryString += `&iusizes${i}=${encodeURIComponent(sizes.join(','))}`; } if (slotSequence !== undefined && slotSequence !== null) { @@ -333,19 +336,24 @@ const parseAuctionConfigs = (serverResponse, bidRequest) => { } } -const getAdUnitCreFormat = (adUnit) => { +const getAdUnitCreFormats = (adUnit) => { if (!adUnit) { return; } - let creFormat = 'html'; - let mediaTypes = Object.keys(adUnit.mediaTypes); + let creFormats = []; - if (mediaTypes && mediaTypes.length === 1 && mediaTypes.includes('native')) { - creFormat = 'native'; + if (adUnit.mediaTypes) { + if (adUnit.mediaTypes.banner) { + creFormats.push('html'); + } + + if (adUnit.mediaTypes.native || adUnit.nativeParams) { + creFormats.push('native'); + } } - return creFormat; + return creFormats; } export const spec = {