Video ads and monetization

You can monetize your video content by serving ads based on leading video ad standards such as VAST, VPAID, and VMAP, including Google DoubleClick or AdSense. This support enables you to include ad banners and pre-, mid- and post-roll ads (with or without a skip option).

The Cloudinary video player's ad support is based on the Google IMA ad platform, which ensures that your ads should run well in most modern browsers and mobile devices, and can be integrated with the majority of marketing platforms and ad serving services. For details on exact support, see IMA SDK Support and Compatibility.

On this page:

The basics

To use the ads functionality, make sure to include Google IMA support: https://imasdk.googleapis.com/js/sdkloader/ima3.js.

Afterwards, you can instruct the video player to run ads by including the ads constructor parameter when you instantiate your player, and specifying the relevant AdURL.

The options for what type of ad (banner, pre/mid/post roll) and other options such as mid-roll break times, skip options, etc. are set inside your AdURL, which points to an ad configuration XML file based on one of the standards mentioned at the top of this page.

You can additionally configure a few video player-specific preferences, including some localization and display preferences, and control over how to play ads in playlists.

Ads example

Adding following code snippet to your video player definition instructs it to run the specified (sample) ad only in the first video of the playlist, to apply the Spanish locale (which controls localization of elements within the adTag, such as the 'Skip' button language), and also sets the video player's ad countdown text to customized Spanish text:

<script src="https://imasdk.googleapis.com/js/sdkloader/ima3.js" type="text/javascript"></script>


var myAdTag = "https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dskippablelinear&correlator=";


var player = cld.videoPlayer("example-player", {
  playlistWidget: {
    direction: "horizontal",
    total: 4
  },
  ads: {
    adTagUrl: myAdTag, 
    locale:"es",
    adsInPlaylist: 'first-video', 
    adLabel:"Tu video comenzará en"
    }
});
...
...

video_player_ad_options_sample

For details on all available options for the ads parameter, see the Constructor params section of the Video Player API Reference.

If you want more fine control, you can directly access the videojs object and then apply the settings available in the Video.js IMA SDK Plugin.

Note
Ads are not displayed when the source file playing in the video player is an .mp3 audio file.