<img src="https://img.shields.io/badge/%20-ENTERPRISE-%23B10031" style="float:left"/><br />

After [adding ads](πŸ”—ο»Ώ) to your content, you can define ad rules that control how often a viewer sees ads while watching your video content.

  • If you are publishing playlists that consist of short-duration videos, like tutorials or product reviews, you can define `startOn` (the first playlist item allowing ad playback) and `frequency` (the regularity of ads within a playlist).

  • If you are publishing long-form content, like webinars or interviews, you can define `startOnSeek` (which determines if a returning visitor is served a pre-roll before resuming content playback) and `timeBetweenAds` (which sets the minimum time that must elapse between ads playback).

  • If you want to prevent ads from playing when the player is on an inactive tab, you can add `deferAds: {}` which prevents ad playback when the player's browser tab is inactive and plays the last deferred ad break when the player's browser tab is active again.

You can read the [Ad rules reference](πŸ”—ο»Ώ) to learn more about how each ad rule impacts a user's experience.

ο»Ώ

β€’ When using a VAST (`vast`) ad client, you can define any of the four `advertising.rules` properties.

β€’ When using an IMA (`googima`) or a FreeWheel (`freewheel`) ad client, you can only define `startOn` and `frequency`.

β€’ When using Google's Dynamic Ad Insertion (`dai`) ad client, **none** of the `advertising.rules` properties are applicable.

<br /> <hr />

## Implementation

ο»Ώ

If you are using a cloud-hosted player, you can define the ad rules for an [ad schedule](πŸ”—ο»Ώ) in your JWP dashboard and associate the ad schedule with your cloud-hosted player. The ad schedule will play in every instance of the embedded player.

<br />

Use the following steps and code samples to define ad rules for an [embedded player](πŸ”—ο»Ώ) with an [ad schedule](πŸ”—ο»Ώ):

  1. Add a [rules](πŸ”—ο»Ώ) object within the `advertising` object.

  2. Configure the properties of the `rules` object for your use case.

You can build upon this basic implementation by [setting up Player Bidding](πŸ”—ο»Ώ).

<br /> <hr />

## Examples

### Example 1: Short-form content

The following example illustrates a short-form media item with a pre-roll. The first ad plays before the first playlist item (`startOn: 1`). Then, subsequent pre-rolls appear for every third playlist item (`frequency: 3`), starting with the fourth playlist item.

ο»Ώ

<br />

### Example 2: Long-form content

The following example illustrates a long-form media item with multiple ad breaks. The `startOnSeek` and `timeBetweenAds` (set to 300 seconds) ad rules have been defined.

ο»Ώ

<br />

### Example 3: Long-form content with deferred ad playback

The following example illustrates a long-form media item with multiple ad breaks. The `deferAds{}` and `timeBetweenAds` (set to 300 seconds) ad rules have been defined.

ο»Ώ

For this example, assume the video is 60 minutes and a viewer takes the following actions:

  • Starts this video from the beginning

  • Opens a new tab when the video time is `00:10:00:000`

  • Returns to the video when the video time is `00:42:10:000`

<br />

Based on the code example, the viewer would view the following ads:

  • The pre-roll (`offset: "pre"`) and first mid-roll (`offset: 300`) ads before opening a new tab

  • The fourth mid-roll ad (`offset: "50%"`) when she returns to the player's browser tab at `00:42:10:000`

  • The post-roll ad

The second and third mid-roll ads would not be played due to the `deferAds{}` rule. The last mid-roll would not be played due to `timeBetweenAds`.

<br />

<br />

<!-- Removes the automatic page-to-page navigation at the bottom of the page -->

<style> .rm-Pagination { display: none; } </style>