Skip to content

Commit

Permalink
PubMatic Bid Adapter: native 1.2 support (prebid#9701)
Browse files Browse the repository at this point in the history
* Changes for native 1.2 support

* Bug fixes and testacases updation

* Changes to include ext and mimes properties of assets and added condition to read len OR length param value

* Bug fixes

* Bug fix and test cases fix

* Test

* Test
  • Loading branch information
pm-priyanka-deshmane authored and jorgeluisrocha committed May 18, 2023
1 parent 148bb10 commit 7a2b26e
Show file tree
Hide file tree
Showing 3 changed files with 271 additions and 233 deletions.
13 changes: 12 additions & 1 deletion modules/pubmaticAnalyticsAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,17 @@ function gatherPartnerBidsForAdUnitForLogger(adUnit, adUnitId, highestBid) {
}, [])
}

function getSizesForAdUnit(adUnit) {
var bid = Object.values(adUnit.bids).filter((bid) => !!bid.bidResponse && bid.bidResponse.mediaType === 'native')[0];
if (!!bid || (bid === undefined && adUnit.dimensions.length === 0)) {
return ['1x1'];
} else {
return adUnit.dimensions.map(function (e) {
return e[0] + 'x' + e[1];
})
}
}

function getAdUnitAdFormats(adUnit) {
var af = adUnit ? Object.keys(adUnit.mediaTypes || {}).map(format => MEDIATYPE[format.toUpperCase()]) : [];
return af;
Expand Down Expand Up @@ -346,7 +357,7 @@ function executeBidsLoggerCall(e, highestCpmBids) {
'sn': adUnitId,
'au': origAdUnit.adUnitId || adUnitId,
'mt': getAdUnitAdFormats(origAdUnit),
'sz': adUnit.dimensions.map(e => e[0] + 'x' + e[1]),
'sz': getSizesForAdUnit(adUnit, adUnitId),
'ps': gatherPartnerBidsForAdUnitForLogger(adUnit, adUnitId, highestCpmBids.filter(bid => bid.adUnitCode === adUnitId)),
'fskp': floorData ? (floorData.floorRequestData ? (floorData.floorRequestData.skipped == false ? 0 : 1) : undefined) : undefined,
};
Expand Down
Loading

0 comments on commit 7a2b26e

Please sign in to comment.