Instead of changing each ad setting in a Limelight Video Platform account, publishers can utilize APIs to dynamically apply ads or override channel ad settings. This offers increased control over what ads are displayed for a channel or individual media. Ads can be programmatically controlled via javascript or via embed code flashvars. The sections that follow outline each of these two approaches.
Dynamic ad settings for media and channels can be inserted and controlled via the following Javascript functions. These functions can be used in conjuction with a javascript callback function, allowing you to insert ads following a player event such as 'onPlayerLoad'. See the
Limelight Video Platform Player API for more information on Limelight Video Platform callback functions and events.
The following functions can be used to dynamically control advertising settings (example usage can be found in the sections below this table):
| Event |
Description |
Parameters |
doSetAd (position: string, type: string, params: string) |
Defines custom ad settings for all media played during the player session |
- position (string) - valid values are 'preroll' and 'postroll'
- type (string) - valid values are 'Adtech', 'Adaptv', 'Acudeo', 'Dart', 'LiveRail', 'OAS', 'None'
- params (string) - ad provider specific settings, delimited by '&'
|
doSetAddFrequency (value: integer) |
Control how many video clips to play in between ads. For example, "frequency=3" will indicate to the player that for each ad inserted, 3 more videos will be played back (including the one where ad was inserted) before another ad is inserted. |
- value (integer) - the number of video clips to play in between ads
|
The following lists the required parameters for each specific ad provider. Additional optional paramaters can also be used. See your ad provider's documentation for a list of optional parameters:
| Ad Provider |
Required Parameters |
| Acudeo |
|
| AdTech |
|
| Adaptv |
|
| Dart |
|
| OAS |
|
| LiveRail |
|
Examples of the above functions:
// Dart
//notice that the value for the ad-tag url is url encoded
DelvePlayer.doSetAd('preroll', 'Dart', 'url=http%3A%2F%2Fad.doubleclick.net%2Fpfadx%2FN270.126913.6102203221521%2FB3876671.21%3Bdcadv%3D2215309%3Bsz%3D0x0%3Bord%3D%255Btimestamp%255D%3Bdcmt%3Dtext%2Fxml');
// AdTech
//notice that the value for the ad-tag url is url encoded
DelvePlayer.doSetAd("preroll", "AdTech",
"url=http%3A%2F%2Fadserver.adtechus.com%2Faddyn%2F3.0%2F5153%2F463152%2F0%2F751%2FADTECH%3Bkey%3Dspider");
//Adaptv
DelvePlayer.doSetAd("preroll", "Adaptv", "key=kj734&zid=myzone");
// Acudeo / Tremor
DelvePlayer.doSetAd("preroll", "Acudeo",
"programId=4831b986b775c");
// Removes postroll URL
DelvePlayer.doSetAd("postroll", "None");
// Sets ad frequency to 3
DelvePlayer.doSetAdFrequency(3);
There are two valid advertising Flashvars: "preroll" and "postroll". These define where to insert the ad settings in each media's playback. The list of parameters to these vars are specific to which ad provider is being used, however all must include the "type" parameter which indicates the ad provider. Subsequent parameters are delimited by the '&' symbol. For instance:
type=AdTech&url=http%3A%2F%2Fadserver.adtechus.com
%2Faddyn%2F3.0%2F5153%2F463152%2F0%2F751%2FADTECH%3Bkey%3Dspider
The actual URL parameter is:
http://adserver.adtechus.com/addyn/3.0/5153/463152/0/751/ADTECH;key=spider
Notice that the actual url must be urlencoded so that '=' isn't parsed as a Flashvar. Further note that the whole parameter string needs to be urlencoded again when inserting into html as a Flashvar. The entire Flashvar might look something like this:
// AdTech
preroll=type%3DAdTech%26url%3Dhttp%253A%252F%252Fadserver.adtechus.co
m%252Faddyn%252F3.0%252F5153%252F463152%252F0%252F751%252FADTECH%253B
key%253Dspider
Other examples:
// Adaptv
preroll=type%3DAdaptv%26key%3Dij754
// Acudeo / Tremor
preroll=type%3DAcudeo%26programId%3D4831a996a775c
In conjunction with the "preroll" and "postroll" FlashVars, you can use the "frequency" FlashVar to control how many video clips to play in between ads. For example,
"frequency=3" will indicate to the Player that for each ad inserted, 3 more videos will be
played back (including the one where ad was inserted) before another ad is inserted.
A few things to note:
- If any ad FlashVars are specified, then all ad settings on the Channel will be ignored for the entire player session. Flashvars take precedence and override the channel ad settings
- Ad FlashVars will be applied to ALL media clips played during the player session, EXCEPT any media clip that has "adDisabled" set to true in your Limelight Video Platform Account
- The ad provider parameter keys are CASE-SENSITIVE (e.g. use programId=xxx, not ProgramID=xxx)
- The minimum valid frequency is 1, i.e. insert an ad for every video clip
- If a video clip that was supposed to have ad inserted based on frequency (e.g. 4th video if frequency=3), and the clip had "adDisabled" set to true, then it will be respected and no ad will be inserted, instead, the next clip will have ad inserted (assuming "adDisabled" is set to false)
- Regardless of frequency, the very first video played will always have an ad inserted (assuming "adDisabled" is set to false)