Rubicon able to read mediaTypes.size#2607
Conversation
checkBidRequestSizes is normally present in adaptermanager.js to add the mediaTypes.banner.sizes to bid.sizes. However our adapter need to be able to read these fields in case the method is deprecated. Same for the Video.
| sizes = mapSizes(bid.mediaTypes.banner.sizes); | ||
| } else { | ||
| sizes = Array.isArray(params.sizes) ? params.sizes : mapSizes(bid.sizes) | ||
| } |
There was a problem hiding this comment.
If params.sizes is present it should be used over both bid.sizes and mediaTypes.banner.sizes, so this logic needs to be adjusted.
| if (params.video && params.video.playerWidth && params.video.playerHeight) { | ||
| if (typeof utils.deepAccess(bid, 'mediaTypes.video.playerSize') !== 'undefined') { | ||
| size = bid.mediaTypes.video.playerSize; | ||
| } else if (params.video && params.video.playerWidth && params.video.playerHeight) { |
There was a problem hiding this comment.
@idettman can you review this part to make sure this looks correct?
snapwich
left a comment
There was a problem hiding this comment.
please fix params.sizes to have highest priority.
|
@snapwich , I have edited the change to first look at Rubicon size. Thanks, |
idettman
left a comment
There was a problem hiding this comment.
I discussed with Bobby, and the only issue is changing the second and third else if positions Line #526 and #528 so that banner sizes override bid sizes if present.
So Line 524 - 532 should be:
if (Array.isArray(params.sizes)) {
sizes = params.sizes;
} else if (typeof utils.deepAccess(bid, 'mediaTypes.banner.sizes') !== 'undefined') {
sizes = mapSizes(bid.mediaTypes.banner.sizes);
} else if (Array.isArray(bid.sizes) && bid.sizes.length > 0) {
sizes = mapSizes(bid.sizes)
} else {
utils.logWarn('Warning: no sizes are setup or found');
}
|
@idettman, Thanks, |
Description of change
checkBidRequestSizes is normally present in adaptermanager.js to add the mediaTypes.banner.sizes to bid.sizes. However our adapter need to be able to read these fields in case the method is deprecated.
Same for the Video.
Be sure to test the integration with your adserver using the Hello World sample page.
For any changes that affect user-facing APIs or example code documented on http://prebid.org, please provide:
Other information