You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: dev-docs/modules/dfp_video.md
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,15 +3,14 @@ layout: page_v2
3
3
page_type: module
4
4
title: Module - Google Ad Manager Video
5
5
description: Required for serving instream video through Google Ad Manager.
6
-
module_code : dfpAdServerVideo
6
+
module_code : gamAdServerVideo
7
7
display_name : Google Ad Manager Video Support
8
8
enable_download : true
9
9
vendor_specific: true
10
10
sidebarType : 1
11
11
---
12
12
13
13
14
-
15
14
# Google Ad Manager Video
16
15
17
16
{:.no_toc}
@@ -27,7 +26,10 @@ The standard options:
27
26
28
27
## Step 2: Integrate into your prebid.js configuration
29
28
30
-
The method exposes the [`pbjs.adServers.dfp.buildVideoUrl`]({{site.baseurl}}/dev-docs/publisher-api-reference/adServers.dfp.buildVideoUrl.html) method to use. For an example, see the DFP video guide linked below.
For more information about how to build with modules, see the [Prebid.js project README](https://github.com/prebid/Prebid.js/blob/master/README.md#build-optimization).
@@ -82,16 +82,15 @@ For full details on video ad unit parameters, see [Ad Unit Reference for Video](
82
82
83
83
By default, Prebid.js caps all CPMs at $20. As a video seller, you may expect to see CPMs over $20. In order to receive those bids, you'll need to implement custom price buckets setting the [priceGranularity](/dev-docs/publisher-api-reference/setConfig.html#setConfig-Price-Granularity) object in the `setConfig` method.
84
84
85
-
For instructions and sample code, see [Custom Price Granularity Buckets
86
-
](/dev-docs/examples/custom-price-buckets.html).
85
+
For instructions and sample code, see [Custom Price Granularity Buckets](/dev-docs/examples/custom-price-buckets.html).
87
86
88
87
### 3. Request bids, build video URL
89
88
90
89
Next, we need to do the standard Prebid "add ad units and request bids" dance.
91
90
92
91
In the example below, our callback builds the video URL the player needs using the `buildVideoUrl` method from the Google Ad Manager ad server module that we built into our copy of Prebid.js in the **Prerequisites** section.
93
92
94
-
For more information, see the API documentation for [pbjs.adServers.dfp.buildVideoUrl](/dev-docs/publisher-api-reference/adServers.dfp.buildVideoUrl.html). Understanding the arguments to this method is *especially* important if you plan to pass any custom parameters to Google Ad Manager. The `params` key in the argument to `buildVideoUrl` supports all parameters from the [Google Ad Manager API](https://support.google.com/admanager/answer/1068325).
93
+
For more information, see the API documentation for [pbjs.adServers.gam.buildVideoUrl](/dev-docs/publisher-api-reference/adServers.dfp.buildVideoUrl.html). Understanding the arguments to this method is *especially* important if you plan to pass any custom parameters to Google Ad Manager. The `params` key in the argument to `buildVideoUrl` supports all parameters from the [Google Ad Manager API](https://support.google.com/admanager/answer/1068325).
95
94
96
95
```javascript
97
96
pbjs.que.push(function() {
@@ -106,7 +105,7 @@ pbjs.que.push(function() {
106
105
107
106
pbjs.requestBids({
108
107
bidsBackHandler:function(bids) {
109
-
var videoUrl =pbjs.adServers.dfp.buildVideoUrl({
108
+
var videoUrl =pbjs.adServers.gam.buildVideoUrl({
110
109
adUnit: videoAdUnit,
111
110
params: {
112
111
iu:'/19968336/prebid_cache_video_adunit'
@@ -120,12 +119,12 @@ pbjs.que.push(function() {
120
119
121
120
#### Notes on Prebid Cache
122
121
123
-
The VAST XML has to be cached somewhere because most video players can only work with a URL that returns VAST XML, not VAST directly. Some bidders cache the VAST XML on the server side, while others depend on Prebid.js to perform the caching.
122
+
The VAST XML is typically cached somewhere because GAM expects a URL that returns VAST XML, not a VAST document directly (but see [using the local cache](#local-cache)). Some bidders cache the VAST XML on the server side, while others depend on Prebid.js to perform the caching.
124
123
125
124
* In general, video-enabled bidders must supply `bid.videoCacheKey`, `bid.vastXml`, or `bid.vastUrl` on their responses, and can provide any combination of the three.
126
-
* If `pbjs.setConfig({cache: {URL}})` isn't set and the bidder supplies only `bid.vastXml` in its bid response, [`pbjs.adServers.dfp.buildVideoUrl`](/dev-docs/publisher-api-reference/adServers.dfp.buildVideoUrl.html) will not be able to generate a videoCacheKey, and it will be dropped from the auction.
125
+
* If `pbjs.setConfig({cache: {URL}})` isn't set and the bidder supplies only `bid.vastXml` in its bid response, [`pbjs.adServers.gam.buildVideoUrl`](/dev-docs/publisher-api-reference/adServers.gam.buildVideoUrl.html) will not be able to generate a videoCacheKey, and it will be dropped from the auction.
127
126
* If `pbjs.setConfig({cache: {URL}})` is defined and the bidder responds with `bid.videoCacheKey`, Prebid.js will not re-cache the VAST XML.
128
-
* If `options.url` is passed as an argument to [`pbjs.adServers.dfp.buildVideoUrl`](/dev-docs/publisher-api-reference/adServers.dfp.buildVideoUrl.html):
127
+
* If `options.url` is passed as an argument to [`pbjs.adServers.gam.buildVideoUrl`](/dev-docs/publisher-api-reference/adServers.gam.buildVideoUrl.html):
129
128
* If Prebid Cache is disabled, Prebid sets `description_url` field to the bid response's `bid.vastUrl`.
130
129
* If Prebid Cache is enabled, Prebid sets `description_url` field to the cache URL.
131
130
@@ -136,7 +135,7 @@ Display banners are rendered with the help of the renderAd function. This functi
136
135
```javascript
137
136
pbjs.requestBids({
138
137
bidsBackHandler:function(bids) {
139
-
var videoUrl =pbjs.adServers.dfp.buildVideoUrl({
138
+
var videoUrl =pbjs.adServers.gam.buildVideoUrl({
140
139
adUnit: videoAdUnit,
141
140
params: {
142
141
iu:'/19968336/prebid_cache_video_adunit'
@@ -145,7 +144,7 @@ pbjs.requestBids({
145
144
146
145
// Mark the bid, used in buildVideoUrl, as used
147
146
pbjs.markWinningBidAsUsed({
148
-
adUnitCode:videoAdUnit.code// optional if you know the adId
147
+
adUnitCode:videoAdUnit.code,// optional if you know the adId
149
148
adId:bid.adId// optional
150
149
});
151
150
@@ -189,6 +188,63 @@ In the body of the page, the following HTML and JS will show the ad:
189
188
190
189
If you have [set up your ad server line items and creatives correctly]({{site.baseurl}}/adops/setting-up-prebid-video-in-dfp.html), you should see an instream pre-roll video ad followed by the oceans video from the [video.js homepage](https://videojs.com/).
191
190
191
+
<aid="local-cache"></a>
192
+
193
+
### 5. Using the local cache
194
+
195
+
Since version 10.23 it is possible to work around GAM's requirement for a cached VAST URL by using a combination of [client side caching](/dev-docs/publisher-api-reference/setConfig.html#client-side-caching-of-vast-xml) and [`getVastXml`](/dev-docs/publisher-api-reference/adServers.gam.getVastXml.html). This uses the same setup described above, except that the cache is set to local:
196
+
197
+
```javascript
198
+
pbjs.setConfig({
199
+
cache: {
200
+
useLocal:true
201
+
}
202
+
});
203
+
```
204
+
205
+
And passing a VAST document directly to the player (instead of an ad tag URL). Using VideoJS:
* when Prebid receives a video bid, it stores its VAST document in the browser as a [blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob), and updates its `.videoCacheKey` with the ID of that blob;
237
+
*`getVastXml` first makes a request to GAM (using the URL returned by `getVideoUrl`);
238
+
* If a Prebid bid wins the GAM auction (and the line items are set up as described in [GAM Step by Step - Video Creatives](/adops/setting-up-prebid-video-in-dfp.md)), the response will contain a VAST URL with a cache key that matches a blob ID;
239
+
*`getVastXml` scans the response for such URLs, and replaces them with an inlined copy of the matching VAST XML from blob storage.
240
+
241
+
This means that you can migrate an existing setup using a 3rd party cache service to local caching without any changes in GAM (the VAST URLs in GAM creatives are ignored except for the cache key portion).
242
+
243
+
{: .alert.alert-warning :}
244
+
Video players often add signals to the GAM ad tag URL. They cannot do this when using `getVastXml`, as there is no URL to augment. This can impact the GAM auction; in practice, this means that using client-side caching will likely result in lower AdX demand.
245
+
246
+
<aid="examples"></a>
247
+
192
248
## Working Examples
193
249
194
250
**Note:** Prebid video is designed to work across devices and browsers. This demo has been developed and tested only for Chrome desktop, Firefox desktop, and Chrome Android; additional device/browser support is planned to be added at a later date.
0 commit comments