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

Add a reference doc for the adUnit object #558

Merged
merged 46 commits into from
Feb 8, 2018
Merged
Changes from 2 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
bf8530d
Add first draft of ad unit reference
Jan 22, 2018
6075ad1
Add examples to ad unit reference
Jan 22, 2018
41f7650
Add native aspect ratio info to AN adapter docs (#543)
rmloveland Jan 24, 2018
5c31c6c
Add multiformat ad unit information (#541)
matthewlane Jan 24, 2018
849e775
update tag samples with multiformat syntax (#528)
jsnellbaker Jan 24, 2018
2a1f434
Re-add trailing spaces to info boxes (#573)
matthewlane Jan 25, 2018
7838c6c
Add note about non-1.0 adapters (#570)
matthewlane Jan 26, 2018
8485dc6
suppord prebid.js 1.0 Colossusssp (#560)
Jan 26, 2018
6528878
Update vertamedia.md (#567)
Millerrok Jan 29, 2018
adbf04f
Add multiformat docs: developers, ad ops, example code (#561)
rmloveland Jan 29, 2018
21792fa
update prebid version download page 1.2.0 & 0.34.2 (#580)
Jan 30, 2018
34312ae
Provide a high-level description of an ad unit
Jan 30, 2018
f91563f
Remove monospacing from section headers
Jan 30, 2018
59f410b
Fix up anchor links to use object properties
Jan 30, 2018
c24e6b5
Add multi-format example
Jan 30, 2018
f3ffb3a
Update description of `sizes` per feedback
Jan 30, 2018
73a556d
Update `bids` description based on feedback
Jan 30, 2018
d898dcb
Update `mediaTypes` description
Jan 30, 2018
0d91a4c
Edit scope description for `{banner,native,video}`
Jan 30, 2018
deadcb4
There is no `mediaTypes.native.sizes`
Jan 30, 2018
3525e50
Add link to docs on pre-defined native types
Jan 30, 2018
d371f5b
Update `native.title` description per feedback
Jan 30, 2018
bccf932
Mark all native assets as optional
Jan 30, 2018
900b2e4
Update `native.body` description
Jan 30, 2018
a761885
`sponsoredBy` is an object
Jan 30, 2018
27bc64b
Update `native.image` description
Jan 30, 2018
ca5181d
Remove Prebid Native validation warning
Jan 30, 2018
083a247
Native ad validation checks for landing page URL
Jan 30, 2018
84afc6c
`sizes` and `aspect_ratios` are both allowed
Jan 30, 2018
cecd7a4
Update `native.title.len` description
Jan 30, 2018
8b2c1c1
Mark `context` as optional
Jan 30, 2018
dbc79b2
Mark `required` properties as optional
Jan 30, 2018
7332e64
Media.net bidder added (#549)
vedantseta Jan 30, 2018
e5e69d1
vi bid adapter docs (#537)
SnoopInf Jan 31, 2018
1a29498
Add : docs for NasmediaAdmixer Adapter (#536)
NasmediaWebtech Jan 31, 2018
74dd56c
Added Inskin bid adapter docs (#548)
richardStrang Jan 31, 2018
78b4bac
RockYou Adapter: Added docs for the RockYou Bidder Adapter (#551)
cameronhotchkies Jan 31, 2018
16ae16a
Prebid v1 smart (#565)
Spacedragoon Jan 31, 2018
b915cca
Adding Optimera doc. (#569)
mcallari Jan 31, 2018
201f427
PubMatic 1.0 Adapter Updates (#530)
mike-chowla Jan 31, 2018
67e7f23
Gjirafa bidder params documentation (#483)
agon-qurdina Jan 31, 2018
be02c24
Add `body.len` to table with description
Jan 31, 2018
53a6e3f
Update `mimes`, `protocols`, `playbackmethods`
Jan 31, 2018
4faeda1
Merge branch 'master' into adunit-reference
rmloveland Feb 6, 2018
0333fd6
s/sizes/playerSize/g for video ads
Feb 8, 2018
42b9c7d
Pass `placementId` as a string in examples
Feb 8, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
342 changes: 342 additions & 0 deletions dev-docs/adunit-reference.md
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. |
Copy link
Contributor

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 appropriate mediaTypes.banner|native|video object"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in f3ffb3a

| `bids` | Required | Array[Object] | Each bid represents a request to a bidder. For a list of properties, see [Bids](#bids) below. |
Copy link
Contributor

Choose a reason for hiding this comment

The 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".

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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. |
Copy link
Contributor

Choose a reason for hiding this comment

The 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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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 |
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's order this "banner", "native", "video"

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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). |
Copy link
Contributor

Choose a reason for hiding this comment

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

"At least one of the 'banner', 'native' or 'video' objects is required."

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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]]`. |
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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`. |
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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). |
Copy link
Contributor

Choose a reason for hiding this comment

The 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."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in d371f5b

Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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). |
Copy link
Contributor

Choose a reason for hiding this comment

The 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."

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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). |
Copy link
Contributor

Choose a reason for hiding this comment

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

sponsoredBy is an Object, not a String.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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). |
Copy link
Contributor

Choose a reason for hiding this comment

The 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."

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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). |
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

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 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">
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the warning from this page in ca5181d

Updated the native ad validation section in 'Show Native Ads' to note that native bid responses must define a landing page URL in 083a247

<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. |
Copy link
Contributor

Choose a reason for hiding this comment

The 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).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is it true that the "required" property is required?

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 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 [`image.aspect_ratios`](#native-image-aspectratios). |
Copy link
Contributor

Choose a reason for hiding this comment

The 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"?

Copy link
Contributor Author

@rmloveland rmloveland Jan 30, 2018

Choose a reason for hiding this comment

The 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 sizes, ..." in 84afc6c


<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. |
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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`
Copy link
Contributor

Choose a reason for hiding this comment

The 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`
Copy link
Contributor

Choose a reason for hiding this comment

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

The "body" object should have a "len" property.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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`
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

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 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.,

<a name="adUnit.mediaTypes.native.icon" />

If we consolidate I'm not sure how to make clear to someone clicking in from another page, who wants adUnit.mediaTypes.native.icon.aspect_ratios but gets the image version, that "oh these are the image docs but they're the same for icon". We could add notes, except that we have to duplicate the note in a couple places so it's not much of a win dupe-wise IMO.


{: .table .table-bordered .table-striped }
| Name | Scope | Type | Description |
|-----------------+----------+---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------|
| `required` | Requird | Boolean | Whether an icon asset is required on this ad. |
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo on "Requird" (but should probably be "Optional" anyway).

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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"` |
Copy link
Contributor

Choose a reason for hiding this comment

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

At the moment, I think video.context is optional.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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']` |
Copy link
Contributor

Choose a reason for hiding this comment

The 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”,
“video/mp4”)

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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]` |
Copy link
Contributor

Choose a reason for hiding this comment

The 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"

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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]` |
Copy link
Contributor

Choose a reason for hiding this comment

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

Description should be taken from/ reference the OpenRTB spec.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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],
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be "playerSize" instead of "sizes".

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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]
Copy link
Contributor

Choose a reason for hiding this comment

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

"playerSize" instead of "sizes"

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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