-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
PubMatic bid adapter: while retrieving floor from floor module pass banner-sizes instead of * #7419
Changes from all commits
33762d1
0722354
f2c32c0
37163d1
eaed987
602ee7e
b6fcd36
58381f3
c9fb11b
8ece7fd
28d12a0
05a55e1
e8b10d5
870085f
844ce4e
704eca3
2565cb9
1d75bd4
6adde1e
477c98a
cef5422
c110a7d
e8fb062
d77cd71
817ce3f
cda825e
f34a3ec
f106dc8
1f6937e
06ffe84
5448ceb
e9b90fe
a7a1d12
30b72df
76adbc9
50e13bc
a1c7ca1
96fbadc
4b026e2
38740bc
9daf778
eff8828
ede95de
c98f1a1
312da6d
d92972c
fd4fb2e
e551136
cfdca3c
22505ff
795a54a
433c98b
a0521ac
635fe74
2759212
84737d8
df5fada
9ab7840
ed4b566
f57d220
6a6d1f4
3650c9d
85c9d49
ca82340
12e8f47
5d024e7
4c87d00
93ea6ca
1eaefc8
cd4a279
4e9ff9f
f971232
24b2cd0
6d3d8a1
e77199c
ad80028
534c748
6eb5be6
4616e51
f9212ed
b6581ff
b0f8b51
dea6e23
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -740,22 +740,48 @@ function _addFloorFromFloorModule(impObj, bid) { | |
if (typeof bid.getFloor === 'function' && !config.getConfig('pubmatic.disableFloors')) { | ||
[BANNER, VIDEO, NATIVE].forEach(mediaType => { | ||
if (impObj.hasOwnProperty(mediaType)) { | ||
let floorInfo = bid.getFloor({ currency: impObj.bidfloorcur, mediaType: mediaType, size: '*' }); | ||
if (typeof floorInfo === 'object' && floorInfo.currency === impObj.bidfloorcur && !isNaN(parseInt(floorInfo.floor))) { | ||
let mediaTypeFloor = parseFloat(floorInfo.floor); | ||
bidFloor = (bidFloor == -1 ? mediaTypeFloor : Math.min(mediaTypeFloor, bidFloor)) | ||
let sizesArray = []; | ||
|
||
if (mediaType === 'banner') { | ||
if (impObj[mediaType].w && impObj[mediaType].h) { | ||
sizesArray.push([impObj[mediaType].w, impObj[mediaType].h]); | ||
} | ||
if (utils.isArray(impObj[mediaType].format)) { | ||
impObj[mediaType].format.forEach(size => sizesArray.push([size.w, size.h])); | ||
} | ||
} | ||
|
||
if (sizesArray.length === 0) { | ||
sizesArray.push('*') | ||
} | ||
|
||
sizesArray.forEach(size => { | ||
let floorInfo = bid.getFloor({ currency: impObj.bidfloorcur, mediaType: mediaType, size: size }); | ||
utils.logInfo(LOG_WARN_PREFIX, 'floor from floor module returned for mediatype:', mediaType, ' and size:', size, ' is: currency', floorInfo.currency, 'floor', floorInfo.floor); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. with newer versions of prebid, the Bider Code is prefixed in the console, so we do not need our prefix's anymore (not needed to change this now just something I have to change in our adapter as well!) |
||
if (typeof floorInfo === 'object' && floorInfo.currency === impObj.bidfloorcur && !isNaN(parseInt(floorInfo.floor))) { | ||
let mediaTypeFloor = parseFloat(floorInfo.floor); | ||
utils.logInfo(LOG_WARN_PREFIX, 'floor from floor module:', mediaTypeFloor, 'previous floor value', bidFloor, 'Min:', Math.min(mediaTypeFloor, bidFloor)); | ||
if (bidFloor === -1) { | ||
bidFloor = mediaTypeFloor; | ||
} else { | ||
bidFloor = Math.min(mediaTypeFloor, bidFloor) | ||
} | ||
utils.logInfo(LOG_WARN_PREFIX, 'new floor value:', bidFloor); | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
// get highest from impObj.bidfllor and floor from floor module | ||
// as we are using Math.max, it is ok if we have not got any floor from floorModule, then value of bidFloor will be -1 | ||
if (impObj.bidfloor) { | ||
utils.logInfo(LOG_WARN_PREFIX, 'floor from floor module:', bidFloor, 'impObj.bidfloor', impObj.bidfloor, 'Max:', Math.max(bidFloor, impObj.bidfloor)); | ||
bidFloor = Math.max(bidFloor, impObj.bidfloor) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So we take the max of (pub provided bidder param I can't remember if the intention of the 5.0 was just "read the floors module if you use floor signaling" or "if floors module only use that" Prob the former so I think this PR is fine. Just a note! |
||
|
||
// assign value only if bidFloor is > 0 | ||
impObj.bidfloor = ((!isNaN(bidFloor) && bidFloor > 0) ? bidFloor : UNDEFINED); | ||
utils.logInfo(LOG_WARN_PREFIX, 'new impObj.bidfloor value:', impObj.bidfloor); | ||
} | ||
|
||
function _getFlocId(validBidRequests, flocFormat) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if mediaType = banner => use all sizes
else => use *
👍