Skip to content
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

Merged
merged 7 commits into from Jun 26, 2018

Conversation

moonshells
Copy link
Contributor

Type of change

  • Feature
  • Refactoring (no functional changes, no api changes)

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.

}

let parsedSizes = parseSizes(bid);
if (parsedSizes.length < 1) {
Copy link
Collaborator

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',
Copy link
Collaborator

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.

Copy link
Contributor Author

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.

Copy link
Contributor

@idettman idettman left a 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.

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');
Copy link
Collaborator

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.

Copy link
Collaborator

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'

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
Copy link
Collaborator

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?

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') {
Copy link
Collaborator

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';
Copy link
Collaborator

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?

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
Copy link
Collaborator

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.

Copy link
Collaborator

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.

@snapwich snapwich merged commit 0c4b815 into prebid:master Jun 26, 2018
@moonshells moonshells deleted the outstream branch June 26, 2018 16:58
dluxemburg pushed a commit to Genius/Prebid.js that referenced this pull request Jul 17, 2018
…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
florevallatmrf pushed a commit to Marfeel/Prebid.js that referenced this pull request Sep 6, 2018
…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
StefanWallin pushed a commit to mittmedia/Prebid.js that referenced this pull request Sep 28, 2018
…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
ghost pushed a commit to devunrulymedia/Prebid.js that referenced this pull request Jan 30, 2019
…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
AlessandroDG pushed a commit to simplaex/Prebid.js that referenced this pull request Mar 26, 2019
…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
AlessandroDG pushed a commit to simplaex/Prebid.js that referenced this pull request Mar 26, 2019
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants