From 9c7618c3b7f1e105ac091e0069b9e66527c74a5c Mon Sep 17 00:00:00 2001 From: Rich Loveland Date: Wed, 8 Mar 2017 17:20:36 -0500 Subject: [PATCH] Document adding video support to existing adapter This is basically "How to add a new video bidder adaptor" with the "make a new adaptor" steps removed. --- ...o-support-to-an-existing-bidder-adaptor.md | 76 +++++++++++++++++++ ...integrate-with-the-prebid-analytics-api.md | 2 +- 2 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 dev-docs/add-video-support-to-an-existing-bidder-adaptor.md diff --git a/dev-docs/add-video-support-to-an-existing-bidder-adaptor.md b/dev-docs/add-video-support-to-an-existing-bidder-adaptor.md new file mode 100644 index 0000000000..8f79b63921 --- /dev/null +++ b/dev-docs/add-video-support-to-an-existing-bidder-adaptor.md @@ -0,0 +1,76 @@ +--- +layout: page +title: Add Video Support to an Existing Bidder Adaptor +description: Documentation on how to add video support to an existing bidder adaptor +pid: 27 +top_nav_section: dev_docs +nav_section: adaptors +--- + +
+ +# Add Video Support to an Existing Bidder Adaptor +{:.no_toc} + +This page has instructions for updating your existing bidder adaptor with support for video bidding. + +When in doubt, use an adaptor that already has support for video for reference, such as [the AppNexus AST adaptor in the Github repo](https://github.com/prebid/Prebid.js/blob/master/src/adapters/appnexusAst.js). (The code samples and descriptions below are based on it.) + +* TOC +{:toc} + +## Step 1. Update your bid params + +In order to make sure your adaptor supports video, you'll need to: + +1. Add a `video` object to your adapter's bid parameters like the one in the [AppNexus AST adapter]({{site.github.url}}/dev-docs/bidders.html#appnexusAst). To see an example showing how those video params are processed and added to the ad tag, see [the AST adapter's implementation of the `callBids` function](https://github.com/prebid/Prebid.js/blob/master/src/adapters/appnexusAst.js). + +2. Your bidder will have to support returning a VAST URL somewhere in its bid response. Each new bidder adaptor added to Prebid.js will have to support its own video URL. For more information, see the implementation of [pbjs.buildMasterVideoTagFromAdserverTag](https://github.com/prebid/Prebid.js/blob/master/src/prebid.js#L656). + +## Step 2. Add video information to the bid response + +Once you've created the bid response, assuming it's valid, you must add more video-specific information: + ++ Player width ++ Player height ++ VAST URL + +Note that you'll have to modify the example code below to match the parameters returned by your bidder. We've also omitted a lot of error-checking. You can refer to the [AppNexus AST adapter implementation](https://github.com/prebid/Prebid.js/blob/master/src/adapters/appnexusAst.js#L228) for details. + +{% highlight js %} +var baseAdapter = require('baseAdapter.js'); + +// Pull the ad object out of your bidder's response. +var ad = getRtbBid(tag); + +// The bid request needs a code to identify the bidder. +bidResponse.bidderCode = 'yourBidder'; + +// What is the bid price? +bidResponse.cpm = ad.cpm; + +// Video-specific information: player width and height, and VAST URL. +bidResponse.width = ad.rtb.video.player_width; +bidResponse.height = ad.rtb.video.player_height; +bidResponse.vastUrl = ad.rtb.video.asset_url; +{% endhighlight %} + + + +## Step 3. Update `adapters.json` + +Finally, add `"video"` to the array of media types your adapter supports. + +```javascript +{ + "yourBidder": { + "supportedMediaTypes": ["video"] + } +} +``` + +## Related Topics + ++ [How to Add a New Video Bidder Adaptor]({{site.github.url}}/dev-docs/how-to-add-a-new-video-bidder-adaptor.html) + +
diff --git a/dev-docs/integrate-with-the-prebid-analytics-api.md b/dev-docs/integrate-with-the-prebid-analytics-api.md index 2b8421415b..34ef687bde 100644 --- a/dev-docs/integrate-with-the-prebid-analytics-api.md +++ b/dev-docs/integrate-with-the-prebid-analytics-api.md @@ -2,7 +2,7 @@ layout: page title: Integrate with the Prebid Analytics API description: Integrate with the Prebid Analytics API -pid: 27 +pid: 28 top_nav_section: dev_docs nav_section: adaptors