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

Support multiple media formats within a single ad unit #1991

Merged
merged 8 commits into from
Jan 23, 2018

Conversation

matthewlane
Copy link
Collaborator

@matthewlane matthewlane commented Dec 21, 2017

Type of change

  • Feature

Description of change

This change supports declaring multiple media formats on a single ad unit, and allowing any bidder that supports at least one of those media formats to participate in that ad unit.

Previously, only one media format per ad type was supported, and only bidders that were compatible with that media format were eligible to participate.

Now, an ad unit can declare multiple media types, and any bidder that supports at least one of those types may take part in that auction. Any bidder that isn't compatible with the specified mediaTypes will be dropped from the ad unit. If mediaTypes is not specified on an ad unit, banner is the assumed format and any banner bidder is eligible for inclusion.

This PR also adds hb_format to standard targeting and sets its value based on the bid response object's mediaType property.

Examples:

// each bidder supports at least one of the formats, so all will participate
pbjs.addAdUnits({
  code: 'adunit-code',
  sizes: [[300, 250], [300, 300]],
  mediaTypes: {
    banner: {},
    native: {},
    video: {context: 'outstream'},
  },
  bids: [

    {
      bidder: 'bannerBidder',
      params: {placementId: '481'}
    },

    {
      bidder: 'nativeBidder',
      params: {titleAsset: '516'}
    },

    {
      bidder: 'videoBidder',
      params: {vidId: '234'}
    },

  ]
});
// only nativeBidder and videoBidder will participate
pbjs.addAdUnits({
  code: 'adunit-code',
  sizes: [[300, 250], [300, 300]],
  mediaTypes: {
    native: {},
    video: {context: 'outstream'},
  },
  bids: [

    {
      bidder: 'bannerBidder',
      params: {placementId: '481'}
    },

    {
      bidder: 'nativeBidder',
      params: {titleAsset: '516'}
    },

    {
      bidder: 'videoBidder',
      params: {vidId: '234'}
    },

  ]
});

Copy link
Member

@mkendall07 mkendall07 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work! LGTM

@mkendall07
Copy link
Member

needs a linked docs PR before merge

@mkendall07
Copy link
Member

@matthewlane
Do we need a standard key for media type now?

@matthewlane
Copy link
Collaborator Author

Added hb_mediatype commit, and initial docs draft here prebid/prebid.github.io#541

@matthewlane matthewlane force-pushed the multiformat-requests branch 2 times, most recently from 6247fe7 to 2808763 Compare January 18, 2018 21:05
@ghost ghost assigned matthewlane Jan 18, 2018
@ghost ghost added the in progress label Jan 18, 2018
@matthewlane matthewlane removed their assignment Jan 19, 2018
@@ -52,7 +52,8 @@
"hb_pb",
"hb_size",
"hb_deal",
"hb_source"
"hb_source",
"hb_mediatype"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@matthewlane can you change this to hb_format instead?
it's a little bit shorter

@ghost ghost assigned matthewlane Jan 22, 2018
@ghost ghost added the in progress label Jan 22, 2018
@matthewlane matthewlane removed their assignment Jan 22, 2018
@jaiminpanchal27 jaiminpanchal27 self-requested a review January 22, 2018 20:26
@@ -31,7 +30,7 @@ const SOURCE = 'pbjs';
export const spec = {
code: BIDDER_CODE,
aliases: ['appnexusAst', 'brealtime', 'pagescience', 'defymedia', 'gourmetads', 'matomy', 'featureforward', 'oftmedia', 'districtm'],
supportedMediaTypes: [VIDEO, NATIVE],
supportedMediaTypes: [BANNER, VIDEO, NATIVE],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@matthewlane If i am not wrong all other adapters supporting video or native also needs to be updated. As of now https://github.com/prebid/Prebid.js/blob/master/modules/rubiconBidAdapter.js#L76 Rubicon will not work for banner

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looking in to this

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good callout @jaiminpanchal27. I went through all adapters that have supportedMediaTypes and added 'banner' to those that do support it in addition to 'native' or 'video'. Some adapters only support 'native' or 'video', determined by looking at code and corresponding .md files, and in those cases supportedMediaTypes are left unchanged

@ghost ghost assigned matthewlane Jan 22, 2018
@ghost ghost added the in progress label Jan 22, 2018
@matthewlane matthewlane removed their assignment Jan 22, 2018
Copy link
Collaborator

@jaiminpanchal27 jaiminpanchal27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jaiminpanchal27 jaiminpanchal27 mentioned this pull request Jan 23, 2018
1 task
@mkendall07 mkendall07 merged commit 24033ff into master Jan 23, 2018
@ghost ghost removed the in progress label Jan 23, 2018
@mkendall07 mkendall07 deleted the multiformat-requests branch January 23, 2018 21:57
Millerrok pushed a commit to Vertamedia/Prebid.js that referenced this pull request Jan 24, 2018
* 'master' of https://github.com/prebid/Prebid.js:
  Prebid 1.2.0 Release
  Use polyfilled includes method (prebid#2061)
  RockYou Adapter: Added RockYou Adapter supporting Prebid 1.0 (prebid#1977)
  Optimera Adapter for 1.0. (prebid#1961)
  Use cross-browser integer check (prebid#2058)
  Fix skipped test (prebid#2059)
  Support multiple media formats within a single ad unit (prebid#1991)
  pre1api module that allows use of deprecated pre1.0 API in Prebid 1.0 (prebid#1976)
  Colossus SSP header bidding adapter 1.0.0 (prebid#2029)
  InSkin Bidder Adapter (prebid#2016)
  Update adapter to prebid v1.0 (prebid#1908)
  PubMatic 1.0 adapter (prebid#2011)
dluxemburg pushed a commit to Genius/Prebid.js that referenced this pull request Jul 17, 2018
* Populate ad_types array on all requests

* Remove descriptionUrl

* Allow a bidder to participate on an adunit if it supports at least one of the mediaTypes

* Add hb_mediatype to standard targeting

* Determine when to trigger callback based on bid response

* Change key to hb_format

* Print banner as default when mediaTypes not defined

* Update spportedMediaTypes to include banner for adapters that were implicitly supporting banner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants