Create a custom VAST XML ad tag

Use a VAST XML ad tag to serve ads without an ad server.

If you have a need to run an ad for your own business and have no demand from a direct or programmatic sale, you can create a custom VAST ad tag to serve your ads (for example, "house ads") in your web player. This approach does not require you to partner with an ad server.

👍

IMPORTANT

Similar to other advertising features, you must have a Developer license or an Enterprise license that has been configured to run ads.

Create the ad tag

Use the following steps to create a VAST XML ad and serve it in your web player:

  1. Using the IAB VAST 4.1 specification, create a VAST XML ad.
  2. (Optional) Add trackers to the <Impression> and <ClickThrough> elements.
  3. Save the VAST XML code block as an .xml file.
  4. Upload the .xml file to a location on your domain.
  5. Copy the URL of your .xml file.
<VAST version="2.0">
  <Ad id="static">
    <InLine>
      <AdSystem>Static VAST Template</AdSystem>
      <AdTitle>Static VAST Tag</AdTitle>
      <Impression>http://example.com/pixel.gif?asi=[ADSERVINGID]</Impression>
      <Creatives>
        <Creative>
          <Linear>
            <Duration>00:00:08</Duration>
            <TrackingEvents>
              <Tracking event="start">http://example.com/pixel.gif</Tracking>
              <Tracking event="firstQuartile">http://example.com/pixel.gif</Tracking>
              <Tracking event="midpoint">http://example.com/pixel.gif</Tracking>
              <Tracking event="thirdQuartile">http://example.com/pixel.gif</Tracking>
              <Tracking event="complete">http://example.com/pixel.gif</Tracking>
              <Tracking event="pause">http://example.com/pixel.gif</Tracking>
              <Tracking event="mute">http://example.com/pixel.gif</Tracking>
              <Tracking event="fullscreen">http://example.com/pixel.gif</Tracking>
            </TrackingEvents>
            <VideoClicks>
              <ClickThrough>http://www.jwplayer.com/</ClickThrough>
              <ClickTracking>http://example.com/pixel.gif?r=[REGULATIONS]&gdpr=[GDPRCONSENT]&pu=[PAGEURL]&da=[DEVICEUA]</ClickTracking>
            </VideoClicks>
            <MediaFiles>
              <MediaFile type="video/mp4" bitrate="300" width="480" height="270">
                http://example.com/uploads/myPrerollVideo.mp4
              </MediaFile>
            </MediaFiles>
            <Icons>
              <Icon program="AdChoices" height="16" width="16" xPosition="right" yPosition="top">
                <StaticResource creativeType="image/png">
                  https://example.com/adchoices-sm.png
                </StaticResource>
                <Iconclicks>
                  <IconClickThrough>https://sample-url.com</IconClickThrough>
                </IconClicks>
              </Icon>
            </Icons>
           </Linear>
        </Creative>
      </Creatives>
    </InLine>
  </Ad>
</VAST>


Add tracker macros

JW Player recognizes the following VAST macros that can be appended to trackers in the <Impression> and <ClickThrough> elements. You can read more about these macros and their usage in the VAST 4.1 specification.

[ADSERVINGID]
[ASSETURI]
[CACHEBUSTING]
[CONTENTPLAYHEAD]
[DEVICEUA]
[ERRORCODE]
[GDPRCONSENT]
[PAGEURL]
[PLACEMENTTYPE]
[REGULATIONS]
[TIMESTAMP]


Configure your player to serve your ad

You can now create an ad break with your custom VAST XML

ApproachDescription
DashboardYou can use your JW Player dashboard to configure an ad break.

In the fourth step of How to schedule ad breaks, you can add your VAST XML ad tag URL to the Tag URL field.
Player configuration codeYou can also create an ad break within the web player's configuration code.

In the fourth step of Monetize your content, you can do either of the following:

• Add your VAST XML ad tag URL to the tag property.
• Add your raw VAST XML code to the advertising.vastxml or advertising.schedule[].vastxml property instead of the tag property.


Did this page help you?