Examples

AppNexus Creative

Preview

Code

copy

<script>
  window.srAsyncInit = function() {
    SR({
      partnerID: 'your-streamrail-api-key',
      muted: true,
      content: {
        linkUrl: 'http://www.streamrail.com/',
        url: 'https://www.streamrail.com/videos/new/bg.mp4',
        title: 'streamrail website'
      },
      
      autoplay: true,
      contentAutoplay: true,
      loop: true,
      ads: {
        schedule: [{
          position: 'pre-roll',
          server: {
            tag: 'https://ssp.streamrail.net/ssp/vast/569fa9ee5fbe690002000001/56a0f360d548da0002000003?page_url=[PAGE_URL]&cb=[CB]&pos=[AD_POSITION]&width=[WIDTH]&height=[HEIGHT]&ip=[IP]&ua=[UA]&video_duration=[VIDEO_DURATION]&video_description=[VIDEO_DESCRIPTION]&video_url=[VIDEO_URL]&video_id=[VIDEO_ID]&video_title=[VIDEO_TITLE]&user_lat=[USER_LAT]&user_lan=[USER_LAN]&autoplay=[AUTOPLAY]&mute=[MUTE]&dnt=[DO_NOT_TRACK]'
          }
        }]
      },
      macros: {
        rand: Math.random().toString(),
        cb: '${CACHEBUSTER}',
        publisher: '${REFERER_URL}',
        site: '${REFERER_URL}',
        ctd: '${TAG_ID}',
        deviceid: '${DEVICE_AAID}${DEVICE_APPLE_IDA}',
        carrier: '${CARRIER_ID}',
        lat: '${GEO_LAT}',
        lon: '${GEO_LON}',
        width: '${WIDTH}',
        height: '${HEIGHT}',
        ip: '${USER_IP}',
        ua: '${USER_AGENT}',
        pubid: '${PUBLISHER_ID}',
        sellerid: '${SELLER_MEMBER_ID}',
        placementid: '${TAG_ID}',
        pageUrl: '${REFERER_URL}'
      },
      width: '${WIDTH}',
      height: '${HEIGHT}',
    });
  };

  (function(d, s, id){
     var js, srjs = d.getElementsByTagName(s)[0];
     if (d.getElementById(id)) {return;}
     js = d.createElement(s); js.id = id;
     js.src = "https://sdk.streamrail.com/player/sr.ads.js";
     srjs.parentNode.insertBefore(js, srjs);
   }(document, 'script', 'streamrail-jssdk'));
</script>