Skip to content

Commit

Permalink
Break apart main API page to sub-pages
Browse files Browse the repository at this point in the history
For better UX and to get rid of long pages.
  • Loading branch information
bookwyrm committed Jan 18, 2021
1 parent 23d00e5 commit a6b9e8e
Show file tree
Hide file tree
Showing 32 changed files with 2,775 additions and 2,803 deletions.
2,811 changes: 8 additions & 2,803 deletions dev-docs/publisher-api-reference.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
layout: api_prebidjs
title: pbjs.adServers.dfp.buildAdpodVideoUrl(options) <span style="color:red" markdown="1">[Alpha]</span>
description:
---


{: .alert.alert-info :}
The GAM implementation of this function requires including the `dfpAdServerVideo` module in your Prebid.js build.

This method combines publisher-provided parameters with Prebid.js targeting parameters to build a GAM video ad tag URL that can be used by a video player.

#### Argument Reference

##### The `options` object

{: .table .table-bordered .table-striped }
| Field | Type | Description |
|----------+--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| iu | string | `adunit` |
| description_url | string | The value should be the url pointing to a description of the video playing on the page. |

{% include alerts/alert_important.html content="For long form Prebid.js will add key-value strings for multiple bids. This prevents retrieving the description url from bid." %}

#### Example

```JavaScript
pbjs.que.push(function(){
pbjs.addAdUnits(videoAdUnit);
pbjs.setConfig({
cache: {
url: 'https://prebid.adnxs.com/pbc/v1/cache'
},
adpod: {
brandCategoryExclusion: true
},
brandCategoryTranslation: {
translationFile: "https://mymappingfile.com/mapping.json"
}
});

pbjs.requestBids({
bidsBackHandler: function(bids) {
pbjs.adServers.dfp. buildAdpodVideoUrl({
codes: ['sample-code'],
params: {
iu: '/123456/testing/prebid.org/adunit1',
description_url: 'https://mycontent.com/episode-1'
},
callback: function(err, masterTag) {
// Invoke video player and pass the master tag
}
});
}
});
});
```

{% include alerts/alert_warning.html content="Set the `pbjs.setConfig.cache.url` to the URL that will cache the VAST XML. " %}
83 changes: 83 additions & 0 deletions dev-docs/publisher-api-reference/adServers.dfp.buildVideoUrl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
layout: api_prebidjs
title: pbjs.adServers.dfp.buildVideoUrl(options)
description:
---


{: .alert.alert-info :}
The Google Ad Manager implementation of this function requires including the `dfpAdServerVideo` module in your Prebid.js build.

This method combines publisher-provided parameters with Prebid.js targeting parameters to build a Google Ad Manager video ad tag URL that can be used by a video player.

#### Argument Reference

##### The `options` object

{: .table .table-bordered .table-striped }
| Field | Type | Description |
|----------+--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `adUnit` | object | *Required*. The Prebid ad unit to which the returned URL will map. |
| `params` | object | *Optional*. Querystring parameters that will be used to construct the Google Ad Manager video ad tag URL. Publisher-supplied values will override values set by Prebid.js. See below for fields. |
| `url` | string | *Optional*. The video ad server URL. When given alongside params, the parsed URL will be overwritten with any matching components of params. |
| `bid` | object | *Optional*. The Prebid bid for which targeting will be set. If this is not defined, Prebid will use the bid with the highest CPM for the adUnit. |

{: .alert.alert-warning :}
One or both of options.params and options.url is required. In other words, you may pass in one, the other, or both, but not neither.

##### The `options.params` object

{: .table .table-bordered .table-striped }
| Field | Type | Description | Example |
|-------------------+--------+-----------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------|
| `iu` | string | *Required*. Google Ad Manager ad unit ID. | `/19968336/prebid_cache_video_adunit` |
| `cust_params` | object | *Optional*. Key-value pairs merged with Prebid's targeting values and sent to Google Ad Manager on the video ad tag URL. | `{section: "blog", anotherKey: "anotherValue"}` |
| `description_url` | string | *Optional*. Describes the video. Required for Ad Exchange. Prebid.js will build this for you unless you pass it explicitly. | `https://www.example.com` |

For more information on any of these params, see [the Google Ad Manager video tag documentation](https://support.google.com/admanager/answer/1068325).

#### Examples

There are several different ways to build up your video URL, as shown in the examples below:

Using `options.params` only:

```javascript
pbjs.requestBids({
bidsBackHandler: function(bids) {
var videoUrl = pbjs.adServers.dfp.buildVideoUrl({
adUnit: videoAdUnit,
params: {
iu: '/19968336/prebid_cache_video_adunit',
cust_params: {
section: "blog",
anotherKey: "anotherValue"
},
hl: "en",
output: "xml_vast2",
url: "https://www.example.com",
}
});
invokeVideoPlayer(videoUrl);
}
});
```

Using `options.url` only:

```javascript
var adserverTag = 'https://pubads.g.doubleclick.net/gampad/ads?'
+ 'sz=640x480&iu=/19968336/prebid_cache_video_adunit&impl=s&gdfp_req=1'
+ '&env=vp&output=xml_vast2&unviewed_position_start=1&hl=en&url=https://www.example.com'
+ '&cust_params=section%3Dblog%26anotherKey%3DanotherValue';

var videoUrl = pbjs.adServers.dfp.buildVideoUrl({
adUnit: videoAdUnit,
url: adserverTag
});
```

<a name="module_pbjs.requestBids"></a>

{: .alert.alert-warning :}
In the event of collisions, querystring values passed via `options.params` take precedence over those passed via `options.url`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
layout: api_prebidjs
title: pbjs.adServers.freewheel.getTargeting(options)
description:
---


{: .alert.alert-info :}
The FreeWheel implementation of this function requires including the `freeWheelAdserverVideo` module in your Prebid.js build.

Use this method to get targeting key-value pairs to be sent to the ad server.

+ `pbjs.adServers.freewheel.getTargeting(options)`: returns key-value pair from the ad server.

```javascript

pbjs.adServers.freewheel.getTargeting({
codes: [adUnitCode1],
callback: function(err, targeting) {
//pass targeting to player api
}
});
```
#### Argument Reference

##### The `options` object

{: .table .table-bordered .table-striped }
| Param | Scope | Type | Description |
| --- | --- | --- | --- |
| codes | Optional | `Array` | [`adUnitCode1`] |
| callback | Required | `Function` | Callback function to execute when targeting data is back. |
Loading

0 comments on commit a6b9e8e

Please sign in to comment.