How can we help?

Companion Ads Follow

Zype's web player supports companion ads, pending proper configuration of your ad tag. Companion ads are banner ads displayed on a web page near the video player.

How do I start using Companion Ads?

The following provides a high level outline of steps needed in order to begin using VAST companion ads. Note, steps may vary from ad server to server, and website to website. Please work with your ad ops team and developers to properly configure your ad tags and site to serve companion ads. If you are using Google IMA companion ads, please refer to the IMA documentation provided by Google.

1. Ensure your ad tag is configured to return companion ads as part of its response whenever requests are generated.

Companion ads must be configured within your ad server. Please consult your ad server documentation to determine the best method for configuring companion ads. If you use Google DFP, this may be a helpful starting point for documentation.

2. Configure your website / webpage to display companion ads.

You must add some configuration code to your web page in order to display companion ads in your HTML. This code can be added to a script tag in the body, or as an external JS file. 

An event listener must be attached to the video player to listen for when an ad begins. This event listener takes a function as a parameter that will handle setting up the companion ads and then displays them on the page.

Before adding an event listener to the page, you must wait for the player to load. A complete example code snippet is shown below. *Note: We are currently implementing custom Zype player events for customers to hook in to, but for now, you must wait for the player via interval checking.

Here's example code used on a webpage typical with a VAST companion ad implementation:

/* interval to wait for the player
** check for the player on the page every 200ms
*/
var playerCheck = setInterval(checkForPlayer, 200); 

/* checkForPlayer()
** check for player object, clear interval if it exists, and setup companion ads
*/

function checkForPlayer() {
  /* if the player object is not equal to undefined,
  ** then continue setting up companion ads
  */
  if(typeof theoplayer.ads != 'undefined') {
    // stop the player check interval
    clearInterval(playerCheck);

    // setup the companion ads
    setupCompanionAds();
  }
}

/* setupCompanionAds()
** Add an event listener to the player to listen to when an ad begins
** When the event handler is fired, select the div element to put
** the companion ad into.
** If there is an ad, and if it does have companion ads, loop
** through the array of companion ads adding them to the DOM
*/
function setupCompanionAds() {
  theoplayer.ads.addEventListener('adbegin', function(data) {
  // find your ad container(s)
  var adContainer = document.querySelector('#companion-ad-container');
  // if ad exists
  if(data.ad) {
  // if ad has companion ads
    if(data.ad.companions.length > 0) {
      // loop through array of companion ads
      for (var i = 0; i < data.ad.companions.length; i++) {
        // add companion ad to selected ad container(s)
        adContainer.innerHTML = data.ad.companions[i].contentHTML;
      }
    }
   }
  });
}

3. Configure your ad tag in Zype admin to support companion ads.

The last general step is to configure your ad tag in Zype admin to enable serving of companion ads.

  • Visit Zype's ad tag manager page
  • Click into the ad tag you're interested in configuring to support companion ads, or create a new ad tag if you don't have one yet
  • You may need to limit targeting of this ad tag to Web only, in case companion ads in the response create conflicts with other devices where your linear video ads are being served
  • Toggle ON the 'COMPANION' option and save your ad tag.

Zype_DFP_Companion_Ads.jpg

After completing this set up process, you should be ready to start serving companion ads! Please make sure to test on a web page to ensure companion ads are being requested and rendered as expected.

Comments

Please sign in to leave a comment.