-
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
allow outstream video, remove parsePosition method, simplify code #2683
Conversation
} | ||
|
||
let parsedSizes = parseSizes(bid); | ||
if (parsedSizes.length < 1) { |
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.
@idettman can you review this? not sure if this is undoing the work you've done recently with the mediaTypes.
@@ -150,14 +139,14 @@ export const spec = { | |||
let slotData = { | |||
site_id: params.siteId, | |||
zone_id: params.zoneId, | |||
position: parsePosition(params.position), | |||
position: params.position === 'atf' || params.position === 'btf' ? params.position : 'unknown', |
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.
why undo this? I think this logic was purposely moved into parsePosition
since its shared with the p_pos
logic below.
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.
I'm trying to follow openRTB standard and remove parsePosition for video: after the video endpoint migrated to PBS Java openRTB, the new endpoint runs auction with OpenRTB 2.5 bid request, which uses integer values for ads position.
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.
LGTM, with the caveat that we should have Bobby run his tests to make sure it behaves the same.
modules/rubiconBidAdapter.js
Outdated
if (hasVideoMediaType(bid)) { | ||
// Log warning if mediaTypes contains both 'banner' and 'video' | ||
if (typeof utils.deepAccess(bid, `mediaTypes.${BANNER}`) !== 'undefined') { | ||
utils.logWarn('Warning: instream video and banner requested for same ad unit, continuing with video instream request'); |
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.
Remove instream
-> As of now this is logged when it has outstream as well, so is misleading.
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.
** Actually, instead, we may want to alter this check actually. **
We could just add a check for if the video is instream with typeof utils.deepAccess(bid,
mediaTypes.${BANNER}) !== 'undefined'
&& utils.deepAccess(bid,
mediaTypes.${VIDEO}.context) === 'instream'
modules/rubiconBidAdapter.js
Outdated
floor: parseFloat(params.floor) > 0.01 ? params.floor : 0.01, | ||
element_id: bidRequest.adUnitCode, | ||
name: bidRequest.adUnitCode, | ||
language: params.video.language, | ||
width: size[0], | ||
height: size[1], | ||
size_id: params.video.size_id | ||
size_id: utils.deepAccess(bidRequest, `mediaTypes.${VIDEO}.context`) === 'outstream' ? 203 : params.video.size_id |
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.
We are setting the size_id
to be 203
no matter what if it is outstream,
Above at line 102 we reject a video bid request if it does not contain params.video.size_id
So are we requiring that anyone who uses outstream with us place size_id
in the video params field?
Looks to me like if we are just always changing it to 203
ourselves, we should not have this strict check above?
modules/rubiconBidAdapter.js
Outdated
utils.logWarn('Warning: instream video and banner requested for same ad unit, continuing with video instream request'); | ||
} | ||
// Bid is invalid if legacy video is set but params video is missing size_id | ||
if (typeof utils.deepAccess(bid, 'params.video.size_id') === 'undefined') { |
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 the bid is outstream
we are later defaulting it to be size_id
203
later anyways.
Let's make this check strictly for instream, and if it is outstream without a size_id, we can just let it defualt itself to 203
like it does on line 149
* @returns {boolean} | ||
*/ | ||
export function hasVideoMediaType(bidRequest) { | ||
return bidRequest.mediaType === VIDEO || typeof utils.deepAccess(bidRequest, `mediaTypes.${VIDEO}`) !== 'undefined'; |
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.
So bidRequest.mediaType === VIDEO
is supporting legacy way of declaring video bid.
But in the Validations we return false if mediaTypes.video.context is neither instream or outstream? (Line 115)
Am I missing something or would a legacy video bid where mediaType == 'video' no longer ever work because of this?
modules/rubiconBidAdapter.js
Outdated
let parsedSizes = parseSizes(bid); | ||
if (parsedSizes.length < 1) { | ||
} else if (bid.mediaTypes && typeof utils.deepAccess(bid, `mediaTypes.${BANNER}`) === 'undefined') { | ||
// Bid is invalid if mediaTypes video is invalid and a mediaTypes banner property is not defined |
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.
mediaTypes.banner
is not required, if there are no mediaTypes
objects then we want to just default to banner. Not exit out of the bid request.
Let me know if I am missing something, but I would think we want to still continue with banner if mediaTypes is declared but banner is not.
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.
adUnit.sizes will eventually be deprecated, but we still are allowing it for now, and should continue to do so as long as Prebid Core does.
…ebid#2683) * allow outstream video, remove parsePosition method, simplify code * update media type validation rule * update media type validation rule * video objetc bug fix * cover no instream no outstream case * add 'Rubicon bid adapter' as the prefix for log messages
…ebid#2683) * allow outstream video, remove parsePosition method, simplify code * update media type validation rule * update media type validation rule * video objetc bug fix * cover no instream no outstream case * add 'Rubicon bid adapter' as the prefix for log messages
…ebid#2683) * allow outstream video, remove parsePosition method, simplify code * update media type validation rule * update media type validation rule * video objetc bug fix * cover no instream no outstream case * add 'Rubicon bid adapter' as the prefix for log messages
…ebid#2683) * allow outstream video, remove parsePosition method, simplify code * update media type validation rule * update media type validation rule * video objetc bug fix * cover no instream no outstream case * add 'Rubicon bid adapter' as the prefix for log messages
…ebid#2683) * allow outstream video, remove parsePosition method, simplify code * update media type validation rule * update media type validation rule * video objetc bug fix * cover no instream no outstream case * add 'Rubicon bid adapter' as the prefix for log messages
…ebid#2683) * allow outstream video, remove parsePosition method, simplify code * update media type validation rule * update media type validation rule * video objetc bug fix * cover no instream no outstream case * add 'Rubicon bid adapter' as the prefix for log messages
Type of change
Description of change
For outstream video, Rubicon adapter will return video ads response instead of marking the bid request as invalid, so publishers can serve outstream ads with Rubicon when they provide ad unit level renderer. This PR also removes parsePosition method and simplifies code.