Multiple outstream units on page

Display only one ad unit if multiple Outstream ad units are located on a single page

This snippet will first call a Brid in-slide ad unit and if it doesn't get a valid ad served, will call an in-content ad unit to try to display an ad.

<!-- DIV in which the in-content outstream unit should render. Note the ID of the DIV. -->
<div id="myDiv" class="<<player_class>>" itemprop="video" itemscope itemtype=""> </div>

<!-- Reference to the outstream JS file-->
<script type="text/javascript" src="//<<services_domain>>/player/build/<<brid_outstream_script>>"></script>

<!-- Code used for rendering the slider ad unit. -->
  <script type="text/javascript">

  // Call a function (customOnReady) which gets called once the unit is ready for API usage.
   $bos("DIV_ID", {"id":"AD_UNIT_ID","width":"480","height":"270"}, customOnReady);

   // This function checks if an ad is available for display in the slider unit. If no ad is found it calls the in-content unit intialization.
   function customOnReady() {
    this.add('adError', function() {

     // Call in-content unit intialization. Note the ID that is used from the DIV above.
     $bos("DIV_ID", {"id":"AD_UNIT_ID","width":"480","height":"270"});

Did this page help you?