Custom VAST XML


You can use minimal XML code to display your VAST ads:

<VAST version="2.0">
<Ad>
   <InLine>
      <AdSystem></AdSystem>
      <Impression>
         <URL><![CDATA[Link-to-impression-pixel]]></URL>
      </Impression>
      <Creatives>
         <Creative>
            <Linear skipoffset="00:00:05">
               <VideoClicks>
                  <ClickThrough><![CDATA[Link-for-click]]></ClickThrough>
               </VideoClicks>
               <MediaFiles>
                  <MediaFile delivery="progressive" type="video/mp4">
                     <![CDATA[Link-to-mp4]]>
                  </MediaFile>
               </MediaFiles>
            </Linear>
         </Creative>
      </Creatives>
      <Extensions>
         <Extension type="linkTxt"><![CDATA[Go to the advertiser's website]]></Extension>
      </Extensions>
   </InLine>
</Ad>
</VAST>

The link to the impression pixel is needed to count impressions, if you want to collect it. The player will send this request when the ad starts playing. The click-through link is required if the ad is clickable.

The skipoffset parameter allows you to configure the ad skip button (in the example, 5 seconds).

You can generate the ad code dynamically from your server, changing the links depending on the situation. This is called ad rotation. For example, the advertising XML generates your script at site.com/vast/preroll.php?id=[id] - this address you specify in the player settings as an advertising link. To manage ads on different pages, just specify the vast_replace parameter in the player code.

var player = new Playerjs({id:"player", file:"https://site.com/video.mp4", vast_replace:{"[id]":1}});

In this example, the request will go to site.com/vast/preroll.php?id=1

Wrappers

A wrapper is an intermediate document that forwards the request to another VAST. At the same time, it can contain a full set of its own pixels, which will work out at the right time. The minimal wrapper looks like this:

<VAST version="2.0">
   <Ad>
      <Wrapper>
         <AdSystem></AdSystem>
         <VASTAdTagURI>
         <![CDATA[Link-to-another-VAST]]>
         </VASTAdTagURI>
         <Impression>
         <![CDATA[Link-to-impression-pixel]]>
         </Impression>
         <Creatives>
            <Creative>
               <Linear>
                  <TrackingEvents>
                     <Tracking event="click">
                        <![CDATA[Link-to-click-pixel]]>
                     </Tracking>
                  </TrackingEvents>
               </Linear>
            </Creative>
         </Creatives>
      </Wrapper>
   </Ad>
</VAST>

How to completely disable ads in the code

To disable ads in the player code please add vast:0


20.0.5
2024 © PlayerJS

Sign up

Sign up
By signing up, you agree to Terms of Service
Login if you have an account

Restore password

Restore
Forgot email? Contact us