Search
Clear search
Close search
Google apps
Main menu

Companion display ads for DFP Video

Companion ads allow you to link non-video display ad slots to the ads that play in a video player on the same web page.

See an example of how a video and companion ad would display on the same page

Video ad units contains at least one video size, shown below as the 400x300v. This example also illustrates an optional 300x250 companion ad. Learn more about video ad units.  

You can find implementation details about how to use companion ads with Google Publisher Tags in the developer documentation. If you are not using the GPT library, your developers may be able to implement support for companions using the ad API, but the content shown below focuses on GPT features.

Benefits of companion display ads


  • Support for creative sets that include both a linear video ad and up to 6 corresponding display ads.
  • Competitive separation using DFP labels to prevent a video ad and display ads from competing advertisers from rendering at the same time.
  • Ability to backfill from the publisher's network if the VAST response contains fewer companion ads than there are defined display slots on the HTML page.

In order to serve video ads with companion creatives, your video player and web page must both be configured correctly.

  • A video player using the IMA SDK, should set the companion ad sizes into the ciu_szs ad tag parameter on the video ad request.
  • The display ad slots should be defined using DFP GPT tags that have additional javascript that specify how the companion ads should behave.
  • If your video player is an iframe, you need to include a GPT proxy script on your main html page. Learn more in the developer documentation.

GPT methods that support companion ads

GPT javascript Example code in the <head> of a web page

companionAds()

The companionAds() service declares that an ad slot may load with a display ad, but it should defer to the video companion if one is available with the video ad which serves in a video player on the same page.

googletag.defineSlot('/1234/video-parent/child-ad-unit', [300, 250], 'ad‑div‑1')
.addService(googletag.companionAds())
.addService(googletag.pubads());

setRefreshUnfilledSlots()

The setRefreshUnfilledSlots() method with a param of true will ask for companion slots that have not been filled to be automatically backfilled.

googletag.companionAds().setRefreshUnfilledSlots(true);

enableVideoAds()

The enableVideoAds() method ensures that both the GPT call and the IMA SDK ad calls will use the same correlator.

This allows competitive exclusions to work across the video and display ads.

googletag.pubads().enableVideoAds();

disableInitialLoad()

Optional for "auto-play" video pages

The method can prevent the scenario in which a display ad loads to the ad unit, but is displayed for only a few seconds before the video companion ad is delivered.

Compare this with click-to-play ads, where it's not necessary to disable initial load because the display ad should show until the user clicks play, thus loading the companion.

googletag.pubads().disableInitialLoad();

 

Example GPT code including companion display ads


The full <head> of a page might look like this:

<script type='text/javascript'>
 var googletag = googletag || {};
 googletag.cmd = googletag.cmd || [];
 (function() {
  var gads = document.createElement('script');
  gads.async = true; gads.type = 'text/javascript';
  gads.src = 'http://www.googletagservices.com/tag/js/gpt.js';
  var node = document.getElementsByTagName('script')[0];
  node.parentNode.insertBefore(gads, node); })();
</script>

<script type='text/javascript'>
 googletag.cmd.push(function() {
  googletag.defineSlot('/12345/path/to/adunit', [300, 250], // ← set with actual ad unit and sizes for your website    'ad‑div‑1').addService(googletag.companionAds()).addService(googletag.pubads());   googletag.defineSlot('/12345/path/to/aduni', [160, 600], // ← set with actual ad unit and sizes for your website    'ad‑div‑2').addService(googletag.companionAds()).addService(googletag.pubads());   googletag.defineSlot('/12345/path/to/adunit', [728, 90], // ← set with actual ad unit and sizes for your website    'ad‑div‑3').addService(googletag.companionAds()).addService(googletag.pubads());   googletag.companionAds().setRefreshUnfilledSlots(true);
  googletag.pubads().enableVideoAds();   googletag.pubads().disableInitialLoad(); // ← only necessary on auto‑play video pages
  googletag.enableServices();
 });
</script>

 
While the <body> code might look like this:

<div id='ad-div-1' style='width:300px; height:250px;'>
 <script type='text/javascript'>
  googletag.cmd.push(function() { googletag.display('ad-div-1'); });
 </script>
</div>
<div id='ad-div-1' style='width:300px; height:250px;'>
 <script type='text/javascript'>
  googletag.cmd.push(function() { googletag.display('ad-div-2'); });
 </script>
</div>
<div id='ad-div-1' style='width:300px; height:250px;'>
 <script type='text/javascript'>
  googletag.cmd.push(function() { googletag.display('ad-div-3'); });
 </script>
</div>

 
Was this article helpful?
How can we improve it?
How can we improve Video help?

We want to make video help content better for you. Tell us anything you'd like.