-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add a reference doc for the adUnit
object
#558
Changes from 2 commits
bf8530d
6075ad1
41f7650
5c31c6c
849e775
2a1f434
7838c6c
8485dc6
6528878
adbf04f
21792fa
34312ae
f91563f
59f410b
c24e6b5
f3ffb3a
73a556d
d898dcb
0d91a4c
deadcb4
3525e50
d371f5b
bccf932
900b2e4
a761885
27bc64b
ca5181d
083a247
84afc6c
cecd7a4
8b2c1c1
dbc79b2
7332e64
e5e69d1
1a29498
74dd56c
78b4bac
16ae16a
b915cca
201f427
67e7f23
be02c24
53a6e3f
4faeda1
0333fd6
42b9c7d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,342 @@ | ||
--- | ||
layout: page | ||
title: Ad Unit Reference | ||
description: Ad Unit Reference | ||
top_nav_section: dev_docs | ||
nav_section: reference | ||
pid: 10 | ||
--- | ||
|
||
<div class="bs-docs-section" markdown="1"> | ||
|
||
# Ad Unit Reference | ||
{:.no_toc} | ||
|
||
Correctly configuring the `adUnit` object is of central importance to setting up Prebid.js on your site. | ||
|
||
This page is an API reference describing all the features of the `adUnit`. | ||
|
||
{: .alert.alert-success :} | ||
This page is a work in progress. Over time, we will be pointing all `adUnit`-related documentation at this page. We are releasing it now in the hopes that it will be useful even in its incomplete state. | ||
|
||
* TOC | ||
{:toc} | ||
|
||
## `adUnit` | ||
|
||
See the table below for the list of properties on the ad unit. For example ad units, see the [Examples](#addAdUnits-Examples) below. | ||
|
||
|
||
{: .table .table-bordered .table-striped } | ||
| Name | Scope | Type | Description | | ||
|--------------+----------+---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| `code` | Required | String | Unique identifier you create and assign to this ad unit. Used to set query string targeting on the ad. If using GPT, we recommend setting this to slot element ID. | | ||
| `sizes` | Required | Array[Number] or Array[Array[Number]] | All sizes this ad unit can accept. Examples: `[400, 600]`, `[[300, 250], [300, 600]]`. For 1.0 and later, prefer one of the `mediaTypes.*.sizes` listed below. | | ||
| `bids` | Required | Array[Object] | Each bid represents a request to a bidder. For a list of properties, see [Bids](#bids) below. | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Array of bid objects representing the demand partners and associated parameters for a given adUnit. See Bids below". There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated in 73a556d |
||
| `mediaTypes` | Optional | Object | Defines the media type of the ad. For a list of properties, see [Media Types](#mediatypes) below. | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume we'll modify this wording later to refer to multiple media types? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated the description to note that there can be one or more media types on a single ad unit in d898dcb Happy to update that description if you have additional comments! |
||
| `labelAny` | Optional | Array[String] | Used for [conditional ads][conditionalAds]. Works with `sizeConfig` argument to [pbjs.setConfig][setConfig]. | | ||
| `labelAll` | Optional | Array[String] | Used for [conditional ads][conditionalAds]. Works with `sizeConfig` argument to [pbjs.setConfig][setConfig]. | | ||
|
||
<a name="bids" /> | ||
|
||
### `adUnit.bids` | ||
|
||
See the table below for the list of properties in the `bids` array of the ad unit. For example ad units, see the [Examples](#addAdUnits-Examples) below. | ||
|
||
{: .table .table-bordered .table-striped } | ||
| Name | Scope | Type | Description | | ||
|------------+----------+---------------+------------------------------------------------------------------------------------------------------------------------------------------| | ||
| `bidder` | Required | String | Unique code identifying the bidder. For bidder codes, see the [bidder param reference]({{site.baseurl}}/dev-docs/bidders.html). | | ||
| `params` | Required | Object | Bid request parameters for a given bidder. For allowed params, see the [bidder param reference]({{site.baseurl}}/dev-docs/bidders.html). | | ||
| `labelAny` | Optional | Array[String] | Used for [conditional ads][conditionalAds]. Works with `sizeConfig` argument to [pbjs.setConfig][setConfig]. | | ||
| `labelAll` | Optional | Array[String] | Used for [conditional ads][conditionalAds]. Works with `sizeConfig` argument to [pbjs.setConfig][setConfig]. | | ||
|
||
<a name="mediatypes" /> | ||
|
||
### `adUnit.mediaTypes` | ||
|
||
See the table below for the list of properties in the `mediaTypes` object of the ad unit. For example ad units showing the different media types, see the [Examples](#addAdUnits-Examples) below. | ||
|
||
{: .table .table-bordered .table-striped } | ||
| Name | Scope | Type | Description | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's order this "banner", "native", "video" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reordered in 59f410b |
||
|----------+--------------------------------------------------------------+--------+------------------------------------------------------------------------------------------------| | ||
| `banner` | Required, unless either of the other properties are present. | Object | Defines properties of a banner ad. For examples, see [`adUnit.mediaTypes.banner`](#banner). | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "At least one of the 'banner', 'native' or 'video' objects is required." There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated in 0d91a4c |
||
| `video` | Required, unless either of the other properties are present. | Object | Defines properties of a video ad. For examples, see [`adUnit.mediaTypes.video`](#video). | | ||
| `native` | Required, unless either of the other properties are present. | Object | Defines properties of a native ad. For properties, see [`adUnit.mediaTypes.native`](#native). | | ||
|
||
<a name="banner" /> | ||
|
||
#### `adUnit.mediaTypes.banner` | ||
|
||
{: .table .table-bordered .table-striped } | ||
| Name | Scope | Type | Description | | ||
|---------+----------+---------------------------------------+-----------------------------------------------------------------------------------------| | ||
| `sizes` | Required | Array[Number] or Array[Array[Number]] | All sizes this ad unit can accept. Examples: `[400, 600]`, `[[300, 250], [300, 600]]`. | | ||
| `name` | Optional | String | Name for this banner ad unit. Can be used for testing and debugging. | | ||
|
||
<a name="native" /> | ||
|
||
#### `adUnit.mediaTypes.native` | ||
|
||
The `native` object contains the following properties that correspond to the assets of the native ad. | ||
|
||
{: .table .table-bordered .table-striped } | ||
| Name | Scope | Type | Description | | ||
|---------------+----------+---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------| | ||
| `sizes` | Required | Array[Number] or Array[Array[Number]] | All sizes this ad unit can accept. Examples: `[400, 600]`, `[[300, 250], [300, 600]]`. | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "mediaTypes.native.sizes" should not be a property, as a native ad does not have a size. Sizes may be specified on certain assets. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, nice catch - thanks! Removed in deadcb4 |
||
| `type` | Optional | String | Used as a shorthand, e.g., `type: 'image'` implies required fields `image`, `title`, `sponsoredBy`, `clickUrl`. | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we link to http://prebid.org/dev-docs/show-native-ads.html#pre-defined-native-types here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great idea, added link in 3525e50 |
||
| `title` | Required | Object | The title of the ad, usually a call to action or a brand name. For properties, see [`native.title`](#native-title). | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The title is not the same as a call to action or brand name (each of which have dedicated assets). Let's say something like "The title object is to be used for the title element of the Native ad." There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated in d371f5b There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. None of the native assets (title, body, sponsoredBy, icon, image, clickUrl, cta) should be required in the mediaTypes.native object. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated to mark all asset fields as optional in bccf932 |
||
| `body` | Required | Object | Text of the ad copy. For properties, see [`native.body`](#native-body). | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "The body object is to be used for the body element of the Native ad." There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated in 900b2e4 |
||
| `sponsoredBy` | Required | String | The name of the brand associated with the ad. For properties, see [`native.sponsoredBy`](#native-sponsoredby). | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sponsoredBy is an Object, not a String. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice catch, thanks! Updated in a761885 |
||
| `icon` | Optional | Object | The brand icon that will appear with the ad. For properties, see [`native.icon`](#native-icon). | | ||
| `image` | Optional | Object | A picture that is associated with the brand, or grabs the user's attention. For properties, see [`native.image`](#native-image). | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "The image object is to be used for the main image of the Native ad." There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated in 27bc64b |
||
| `clickUrl` | Optional | Object | Where the user will end up if they click the ad. For properties, see [`native.clickUrl`](#native-clickurl). | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we sure that this is a property that publishers should be setting in the mediaTypes.native object? All native bid responses should be required to provide a clickUrl regardless of the specification here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should leave it in the ad unit docs until it's removed from the Prebid.js code. Although it's a required part of the native bid response, for example it's currently listed as a part of the "image-type" native ad unit in native.js. I can remove it now if you really want me to though, I don't hold the above opinion very strongly or think it makes much difference either way. What do you think? |
||
| `cta` | Optional | Object | *Call to Action* text, e.g., "Click here for more information". For properties, see [`native.cta`](#native-cta). | | ||
|
||
<div class="alert alert-warning"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I kind of think that this warning seems a bit out of place in a page dedicated to the adUnit. In any section on Prebid Native Ad Validation, we should also mention that all native bid responses must define a landing page url. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
<strong>Prebid Native Ad Validation</strong> | ||
<p> | ||
Prebid.js validates the assets on native bid responses like so: | ||
<ul> | ||
<li> | ||
If the asset is marked as "required", it checks the bid response to ensure the asset is part of the response | ||
</li> | ||
<li> | ||
However, Prebid.js does not do any additional checking of a required asset beyond ensuring that it's included in the response; for example, it doesn't validate that the asset has a certain length or file size, just that that key exists in the response JSON | ||
</li> | ||
</ul> | ||
</p> | ||
</div> | ||
|
||
<a name="native-image" /> | ||
|
||
##### `adUnit.mediaTypes.native.image` | ||
|
||
{: .table .table-bordered .table-striped } | ||
| Name | Scope | Type | Description | | ||
|-----------------+----------+---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------| | ||
| `required` | Required | Boolean | Whether this asset is required. | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it true that the "required" property is required? (Same comment for all other asset objects below as well). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Looks like the answer is no, Prebid.js just filters the list to only required objects according to my reading of https://github.com/prebid/Prebid.js/blob/master/src/native.js#L105 Updated all mentions of the |
||
| `sizes` | Optional | Array[Number] or Array[Array[Number]] | All sizes this ad unit can accept. Examples: `[400, 600]`, `[[300, 250], [300, 600]]`. | | ||
| `aspect_ratios` | Optional | Array[Object] | Instead of `sizes`, you can define allowed aspect ratios. For properties, see [`image.aspect_ratios`](#native-image-aspectratios). | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You say "instead", but can "aspect_ratios" be defined in addition to "sizes"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like the answer is yes: https://github.com/prebid/Prebid.js/blob/master/test/spec/unit/core/adapterManager_spec.js#L836 Updated to say "Alongside |
||
|
||
<a name="native-image-aspectratios" /> | ||
|
||
###### `adUnit.mediaTypes.native.image.aspect_ratios` | ||
|
||
{: .table .table-bordered .table-striped } | ||
| Name | Scope | Type | Description | | ||
|----------------+----------+---------+------------------------------------------------------------------------------------------------------| | ||
| `min_width` | Optional | Integer | The minimum width required for an image to serve (in pixels). | | ||
| `ratio_height` | Required | Integer | This, combined with `ratio_width`, determines the required aspect ratio for an image that can serve. | | ||
| `ratio_width` | Required | Integer | See above. | | ||
|
||
<a name="native-title" /> | ||
|
||
##### `adUnit.mediaTypes.native.title` | ||
|
||
{: .table .table-bordered .table-striped } | ||
| Name | Scope | Type | Description | | ||
|------------+----------+---------+------------------------------------------------------| | ||
| `required` | Required | Boolean | Whether a title asset is required on this native ad. | | ||
| `len` | Optional | Integer | Length of title text, in characters. | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "len" is meant to specify a maximum length, not an absolute length requirement. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the catch, updated in cecd7a4 |
||
|
||
<a name="native-sponsoredBy" /> | ||
|
||
##### `adUnit.mediaTypes.native.sponsoredBy` | ||
|
||
{: .table .table-bordered .table-striped } | ||
| Name | Scope | Type | Description | | ||
|------------+----------+---------+-----------------------------------------------------------| | ||
| `required` | Required | Boolean | Whether a brand name asset is required on this native ad. | | ||
|
||
<a name="native-clickUrl" /> | ||
|
||
##### `adUnit.mediaTypes.native.clickUrl` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As mentioned above, "clickUrl" should always be implicitly required. |
||
|
||
{: .table .table-bordered .table-striped } | ||
| Name | Scope | Type | Description | | ||
|------------+----------+---------+----------------------------------------------------------| | ||
| `required` | Required | Boolean | Whether a click URL asset is required on this native ad. | | ||
|
||
##### `adUnit.mediaTypes.native.body` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The "body" object should have a "len" property. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, updated in be02c24 |
||
|
||
{: .table .table-bordered .table-striped } | ||
| Name | Scope | Type | Description | | ||
|------------+----------+---------+---------------------------------------------------| | ||
| `required` | Required | Boolean | Whether body text is required for this native ad. | | ||
|
||
<a name="native-icon" /> | ||
|
||
##### `adUnit.mediaTypes.native.icon` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If there's a clean way to consolidate native.icon with native.image, we should do so, since the properties below are identical. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I share that desire, but I don't think we can implement it in a way that isn't a little confusing. Right now the page has specific anchor links to object properties, which will be handy when linking from other pages, e.g.,
If we consolidate I'm not sure how to make clear to someone clicking in from another page, who wants |
||
|
||
{: .table .table-bordered .table-striped } | ||
| Name | Scope | Type | Description | | ||
|-----------------+----------+---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------| | ||
| `required` | Requird | Boolean | Whether an icon asset is required on this ad. | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typo on "Requird" (but should probably be "Optional" anyway). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated all mentions of the required property to note they are optional in dbc79b2 |
||
| `sizes` | Optional | Array[Number] or Array[Array[Number]] | All sizes this ad unit can accept. Examples: `[400, 600]`, `[[300, 250], [300, 600]]`. | | ||
| `aspect_ratios` | Optional | Array[Object] | Instead of `sizes`, you can define allowed aspect ratios. For properties, see [`icon.aspect_ratios`](#native-icon-aspectratios). | | ||
|
||
<a name="native-icon-aspectratios" /> | ||
|
||
###### `adUnit.mediaTypes.native.icon.aspect_ratios` | ||
|
||
{: .table .table-bordered .table-striped } | ||
| Name | Scope | Type | Description | | ||
|----------------+-------+------+-------------| | ||
| `min_width` | Optional | Integer | The minimum width required for an image to serve (in pixels). | | ||
| `ratio_height` | Required | Integer | This, combined with `ratio_width`, determines the required aspect ratio for an image that can serve. | | ||
| `ratio_width` | Required | Integer | See above. | | ||
|
||
<a name="video" /> | ||
|
||
#### `adUnit.mediaTypes.video` | ||
|
||
{: .table .table-bordered .table-striped } | ||
| Name | Scope | Type | Description | | ||
|------------------+----------+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| `context` | Required | String | The video context, either `"instream"` or `"outstream"`. Example: `context: "outstream"` | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At the moment, I think video.context is optional. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, updated in 8b2c1c1 |
||
| `playerSize` | Optional | Array[Integer,Integer] | The size (width, height) of the video player on the page, in pixels. Example: `playerSize: [640, 480]` | | ||
| `mimes` | Optional | Array[String] | Required by OpenRTB when using [Prebid Server]({{site.baseurl}}/dev-docs/get-started-with-prebid-server.html). Example: `mimes: ['video/mp4']` | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The note about "Required by Prebid Server" should feature more prominently. Let's change the scope to something like "Recommended. Required by OpenRTB when using Prebid Server...". Description should be taken from OpenRTB spec: Content MIME types supported (e.g., “video/x-ms-wmv”, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated in 53a6e3f |
||
| `protocols` | Optional | Array[Integer] | Required by OpenRTB when using [Prebid Server]({{site.baseurl}}/dev-docs/get-started-with-prebid-server.html). Example: `protocols: [1,2,3,4,5,6,7,8]` | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Description should be taken from/ reference the OpenRTB spec: "Array of supported video protocols" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated in 53a6e3f |
||
| `playbackmethod` | Optional | Array[Integer] | Required by OpenRTB when using [Prebid Server]({{site.baseurl}}/dev-docs/get-started-with-prebid-server.html). Example: `playbackmethod: [2]` | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Description should be taken from/ reference the OpenRTB spec. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated in 53a6e3f |
||
|
||
## Examples | ||
|
||
+ [Banner](#adUnit-banner-example) | ||
+ [Video](#adUnit-video-example) | ||
+ [Native](#adUnit-native-example) | ||
|
||
<a name="adUnit-banner-example"> | ||
|
||
##### Banner | ||
|
||
For an example of a banner ad unit, see below. For more detailed instructions, see [Getting Started]({{site.baseurl}}/dev-docs/getting-started.html). | ||
|
||
```javascript | ||
pbjs.addAdUnits({ | ||
code: slot.code, | ||
mediaTypes: { | ||
banner: { | ||
sizes: [[300, 250], [300, 600]] | ||
}, | ||
bids: [{ | ||
bidder: 'appnexus', | ||
params: { | ||
placementId: '9880618' | ||
} | ||
}, ] | ||
} | ||
}) | ||
``` | ||
|
||
<a name="adUnit-video-example"> | ||
|
||
##### Video | ||
|
||
For an example of an instream video ad unit, see below. For more detailed instructions, see [Show Video Ads]({{site.baseurl}}/dev-docs/show-video-with-a-dfp-video-tag.html). | ||
|
||
```javascript | ||
pbjs.addAdUnits({ | ||
code: 'video', | ||
mediaTypes: { | ||
video: { | ||
context: "instream", | ||
sizes: [640, 480], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be "playerSize" instead of "sizes". There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed in 0333fd6 |
||
}, | ||
}, | ||
bids: [{ | ||
bidder: 'appnexus', | ||
params: { | ||
placementId: '9333431', | ||
video: { | ||
skippable: true, | ||
playback_methods: ['auto_play_sound_off'] | ||
} | ||
} | ||
}] | ||
}); | ||
``` | ||
|
||
For an example of an outstream video ad unit, see below. For more detailed instructions, see [Show Outstream Video Ads]({{site.baseurl}}/dev-docs/show-outstream-video-ads.html). | ||
|
||
```javascript | ||
pbjs.addAdUnit({ | ||
code: 'video1', | ||
mediaTypes: { | ||
video: { | ||
context: 'outstream', | ||
sizes: [640, 480] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "playerSize" instead of "sizes" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed in 0333fd6 |
||
} | ||
}, | ||
renderer: { | ||
url: 'http://cdn.adnxs.com/renderer/video/ANOutstreamVideo.js', | ||
render: function(bid) { | ||
ANOutstreamVideo.renderAd({ | ||
targetId: bid.adUnitCode, | ||
adResponse: bid.adResponse, | ||
}); | ||
} | ||
}, | ||
... | ||
}) | ||
``` | ||
|
||
<a name="adUnit-native-example"> | ||
|
||
##### Native | ||
|
||
For an example of a native ad unit, see below. For more detailed instructions, see [Show Native Ads]({{site.baseurl}}/dev-docs/show-native-ads.html). | ||
|
||
```javascript | ||
pbjs.addAdUnits({ | ||
code: slot.code, | ||
mediaTypes: { | ||
native: { | ||
image: { | ||
required: true, | ||
sizes: [150, 50] | ||
}, | ||
title: { | ||
required: true, | ||
len: 80 | ||
}, | ||
sponsoredBy: { | ||
required: true | ||
}, | ||
clickUrl: { | ||
required: true | ||
}, | ||
body: { | ||
required: true | ||
}, | ||
icon: { | ||
required: true, | ||
sizes: [50, 50] | ||
}, | ||
}, | ||
bids: [{ | ||
bidder: 'appnexus', | ||
params: { | ||
placementId: '9880618' | ||
} | ||
}, ] | ||
} | ||
}) | ||
``` | ||
|
||
## Related Topics | ||
|
||
+ [Publisher API Reference]({{site.baseurl}}/dev-docs/publisher-api-reference.html) | ||
+ [Conditional Ad Units][conditionalAds] | ||
+ [Show Native Ads]({{site.baseurl}}/dev-docs/show-native-ads.html) | ||
+ [Show Video Ads]({{site.baseurl}}/dev-docs/show-video-with-a-dfp-video-tag.html) | ||
+ [Show Outstream Video Ads]({{site.baseurl}}/dev-docs/show-outstream-video-ads.html) | ||
+ [Prebid.org Video Examples]({{site.baseurl}}/examples/video/) | ||
+ [Prebid.org Native Examples]({{site.baseurl}}/examples/native/) | ||
|
||
</div> | ||
|
||
<!-- Reference Links --> | ||
|
||
[conditionalAds]: {{site.baseurl}}/dev-docs/conditional-ad-units.html | ||
[setConfig]: {{site.baseurl}}/dev-docs/publisher-api-reference.html#module_pbjs.setConfig |
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.
Instead of "For 1.0 and later, prefer one of the
mediaTypes.*.sizes
listed below.", let's say "For 1.0 and later, best practice is to define size(s) within the appropriatemediaTypes.banner|native|video
object"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.
Updated in f3ffb3a