How to set up a standalone ad server on BrightCove?
Written with John Huebner.
Retrieved on May 5, 2011, from http://developer.brightcove.com/en/articles/example-built-ad-server
The following example is an ad translator which can be used to serve video ads or ad SWFs without the use of an ad server. This example is given as an alternative to using a real ad server or to using ad XML without an ad server.
This example is only for video ads and ad SWFs; banners and overlays are not supported. Video ads are served by using a video selected from your Brightcove account, and only one video can be chosen in the key/value pair. Videos that are used as ads will show up within Video Bandwidth in the Brightcove reports, but the video ads will not show up as a Video Play in the reports. Ad SWFs are served by giving the URL of an ad SWF, like the one for Google AdSense for Video.
Here are the basic steps for using the standalone translator:
- Download StandaloneTranslator.zip.
- Place the Standalone.swf file on your webserver. We do not host the standalone ad translator, so you will need to provide your own URL for it.
- Set the ad translator at the player or account level.
- If you are using video ads, upload the video in the Media module.
- If you are using video ads, get a Media API read token, which you can request from customer support. You must also ask customer support to have this token expose the FLV URL.
- Set up the key/value pairs that are needed for a video ad or ad SWF, as described in the next section. The key/value pairs can be set in any of the places they are allowed, such as in the player edit screen.
- Set the rest of the ad policy settings you would like for the player, and then preview the player to see the ad.
The key/value pairs mentioned in step 6 above are essential to using the ad translator. Before we go over the key/value pairs that are required for video ads, note that your Brightcove account must be configured to deliver video content via progressive download (that is, HTTP or PD delivery) or be configured for universal delivery service. If you have an account that delivers content via streaming but does not have universal delivery service enabled, video ads will not play in this example.
You will need to use a key/value pair to provide a video ID or an ad SWF URL so that there is an ad to play. The video ID is specified as follows:
videoID=<The id of the video that you would like to use as an Ad>;
This ID can be found in the media module when the video is selected, as shown below.
If you are providing a video ID, you must also provide the Media API read token, which you can request from customer support. You must also ask customer support to have this token expose the FLV URL.
token=<The Read Token given to you by customer support>;
If you are using the universal delivery service, you must also set a key/value pair for this.
If you want to use an ad SWF instead of a video ad, you must provide the ad SWF URL:
adSWFURL=<URL to the ad SWF>;
For Google AdSense for Video, the URL would be http://admin.brightcove.com/adswf/Google.swf
You can also specify more parameters to pass into the ad SWF by simply adding more key/value pairs which aren’t recognized here. For instance, in order to pass videoPublisherId to the Google ad SWF, you would specify:
You can also provide a Google Analytics ID for tracking the ads. For example:
googleAnalyticsID=<The Google Analytics account id to send tracking data to>;
The ad translator will send an event before the ad has started and when it completes. Note that the start event is not the same as the IAB standard impression event.
If you are providing a video ID, you can specify a click-through URL:
videoClickURL=<URL for the video ad>;
And if you’re having problems, you can add a debug key to see more debug info in flashlog.txt:
All of the key/value pairs mentioned above need to be put together on the same line in whatever location you use to set up your key/value pairs. Here’s an example of a standalone translator set up to serve a video ad and use Google Analytics:
The source is provided in the zip file so that you can make your own changes to the ad translator as needed. The example is heavily commented to make it easy for you to do more with it.
In order to compile the ad translator, follow the steps given in the documentation for creating an ad translator. One additional step is needed, which is that a Google Analytics SWC has to be in the library path to compile. Use the analytics.swc from Google.
There are a few limitations with the standalone ad translator. It only serves video and ad SWFs, and so it does not have support for banners or overlays. Also, the start event that’s sent to Google Analytics is not an IAB standard impression event. The start event may be good enough for your own tracking, however. As noted above, only one video can be chosen in the key/value pair.
If you are willing to compile and make changes to the ad translator yourself, all of the limitations above could be removed. The banners and overlays could be set up in a similar way to ad SWFs by passing in a new key/value pair that gives the URL of a SWF. An IAB standard impression could be added by inserting a startTrackURLs element into the ad XML. More than one video could be chosen by changing the media API call to look at a playlist or to search for a tag.
One limitation that cannot be removed is that the standalone translator is a simple class compared to a real ad server. Ad servers such as Doubleclick and Tremor provide a great deal of functionality, such as day-part targeting, ad campaign frequency capping, etc., that can’t be replicated here. Brightcove has many advertising partners that you can talk with about your advertising needs.