Fixes #2276 - video.playerSize and Size Mapping not working together #2311
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Type of change
Description of change
Currently, using Size Mapping functionality with a video adUnit that specifies
mediaTypes.video.playerSize
would not pass thesizeMapping.js
validation checks causing the ad unit to not be included in thebidRequest
object.As a quick recap, the validation check in the sizeMapping (located here https://github.com/prebid/Prebid.js/blob/master/src/sizeMapping.js#L41) does the following:
[[300, 250], [300, 600]]
) as a list of acceptable sizes (this is derived from the matching mediaQuery params).Because the filtering operates on a list of arrayed sizes, the adUnits.sizes has to use the same format. Otherwise, the filter would treat the single array of sizes ie
[300, 250]
as two integers and the size wouldn't pass the check.To meet this requirement, I changed the
adUnits.mediaTypes.video.playerSize
field to accept either format (ie[[640, 480]]
or[640, 480]
) but it will automatically format the latter syntax into the former.A note - while the
playerSize
field will expect an array of an array, there should only 1 set of sizes in the field. The changes in thecheckBidRequestSizes()
function check for this exact type of setup.Other information
fixes issue reported in #2276