Ads in the video player

General provisions

VAST is a standard that describes the process of serving banners by a video player and sending statistics to an ad server.

Ads are served in accordance with the international media industry standards. This article describes the final solutions within the framework of these standards.

Here's how ads are served: the player requests a video banner, plays the content returned in the VAST response, and sends statistics on impressions and other events to Adfox. This data can also be sent to third-party systems using tracking pixels. This can happen either directly between the video player and Adfox, or between the video player, Adfox, and a third-party ad server. When accessing Adfox, the player receives VAST XML as shown in the example.

Direct interaction scheme between the player and Adfox

  1. Ad request: The video player sends a request to Adfox to get VAST.
  2. VAST response: Adfox provides a VAST response with links to the media files and events required for serving the banner and collecting statistics.
  3. Send statistics: As events occur during ad serving (for example, the video loads, the first quarter is played, and other events), the player sends the event statistics to Adfox.
Interaction scheme that includes a third-party ad server (Wrapper)

  1. Ad request: The video player sends a request to Adfox to get VAST.

  2. VAST redirect (Wrapper): Adfox sends a VAST response that contains event links and the URI of a third-party ad server in the <VASTAdTagURI></VASTAdTagURI> tags.

    Sample Wrapper response from Adfox:

    <?xml version="1.0" encoding="UTF-8"?>
    <VAST version="2.0">
    <Ad id="%campaignId%-%user1%">
    <Wrapper>
            <AdSystem>Adfox</AdSystem>
            <VASTAdTagURI>
            <![CDATA[LINK TO THIRD-PARTY AD SERVER]]>
            </VASTAdTagURI>
            <Error>
            <![CDATA[%event20%]]>
            </Error>
            <Impression>
            <![CDATA[%event3%]]>
            </Impression>
            <Creatives>
            <Creative>
                    <Linear>
                            <TrackingEvents>
                            ...
                            </TrackingEvents>
                            <VideoClicks>
                            <ClickTracking>
                                    <!![CDATA[%request.reference_mrc%]]>
                            </ClickTracking>
                            </VideoClicks>
                    </Linear>
                    </Creative>
            </Creatives>
            <Extensions>
            ...
            </Extensions>
    </Wrapper>
    </Ad>
    </VAST>
    
  3. Ad request: After processing the VAST response from Adfox, the video player makes a request to a third-party ad server using the URI that Adfox sent in the <VASTAdTagURI></VASTAdTagURI> tags.

  4. Send statistics: As events occur during ad serving (for example, the video loads, the first quarter is played, and other events), the player transmits the event statistics to Adfox and to a third-party ad server by sending requests using VAST links.

The Wrapper response contains the Wrapper tag with a link to a third-party ad server. A third-party server can send a Linear Ad or Wrapper banner that links to another ad server. As a result, the last server in the chain must send all the files required for ad serving.

Requirements for advertising materials

Format

MP4, WebM, MOV, QT, AVI

Recommended format

MP4

Frame rate

no more than 60 frames per second

Number of video tracks

1

Audio codecs

AAC, MP3, Vorbis

Number of audio tracks

no more than 1

Minimum resolution (optional)

1280 × 720 pixels

The maximum size of the video clip
to be uploaded to the Adfox interface

100 MB

Available preset templates

Note

The templates listed in this section can be used for banners with the XML load type.

Linear Ads Video

A full-frame ad that pauses the playback of video content. This is usually a video ad, but static images displayed at a certain time may also be used. This type of ad can be served before the video content is played (pre-roll), in a break during content playback (mid-roll), or after the video playback (post-roll).

The content type is a video file.

Linear-Ad (Pre / Mid / Post-roll) VAST 3.0 Viewability
A template with a viewability check. If more than 50% of the player is within the viewable area, a viewability event is triggered after 2 seconds. Event statistics are available in reports.
Linear-Ad (Pre / Mid / Post-roll) VAST 2.0 Compatible No Click
A template for a video without click support.
Linear-Ad (Pre / Mid / Post-roll) VAST 3.0
A template with click support.

Linear Ads Audio

The content type is an audio file.

Linear-Ad (Pre / Mid / Post-roll) Audio VAST 3.0
A template for an audio without click support.

Nonlinear Ads

An overlay ad that's served simultaneously with the main video playback. This is usually a static image that's placed in the player and occupies part of the player area.

Alert

The Overlay (VAST 3.0) Image, Overlay (VAST 3.0) HTML, and Overlay (VAST 3.0) HTML Custom templates only work with third-party players and aren't supported by the Yandex Video Ads SDK library.

Non-Linear Adfox Overlay Image VAST 3.0

A template that displays an image on top of a video. The content type is an image.

Parameters for adding banners to Adfox:

  • Image: A file or link to an image.
  • Width: The image width.
  • Height: The image height.
  • Bottom margin: The player's lower margin (%).
  • Transition URL: The click link.
  • box-shadow: The CSS property that describes the style of shadow cast by the image on the video.

The required parameters are the image, width, and height.

Sample VAST

Non-Linear Adfox Overlay HTML VAST 3.0

A template for displaying arbitrary HTML on top of a video. The content type is HTML code. The entire banner area is clickable.

Parameters for adding banners to Adfox:

  • HTML code: The HTML code of the creative.
  • Width: The iframe banner width.
  • Height: The iframe banner height.
  • Bottom margin: The player's lower margin (%).
  • Transition URL: The click link.
  • box-shadow: The CSS property that describes the style of shadow cast by the image on the video.

The required parameters are the HTML code, width, and height.

Sample VAST

Non-Linear Adfox Overlay HTML Custom VAST 3.0

A template for displaying arbitrary HTML on top of a video. The content type is HTML code. A template where you can set clickable areas.

Parameters for adding banners to Adfox:

  • HTML code: The HTML code of the creative.
  • Width: The iframe banner width.
  • Height: The iframe banner height.
  • Bottom margin: The player's lower margin (%).
  • Transition URL: The click link.
  • box-shadow: The CSS property that describes the style of shadow cast by the image on the video.

The required parameters are the HTML code, width, and height.

Sample VAST

Wrapper (VAST redirect)

A VAST instance that redirects to another URL for receiving ads and contains additional pixels. Used for forwarding third-party ads and measuring events in Adfox.

VAST 2.0 Wrapper can link to the contents of VAST 3.0, and VAST 3.0 Wrapper can link to VAST 2.0.

The content type is a link to VAST XML.

Preset InPage templates available in Adfox

Linear-Ad (Pre / Mid / Post-roll) VAST 2.0 for InPage
A template for the video file content type.
Linear-Ad (Pre / Mid / Post-roll) VAST 3.0 for InPage Viewability
A template for the video file content type with a viewability check.
Wrapper VAST 2.0 for InPage
A template for Wrapper VAST XML content.

To learn more about templates and how to apply them, see InPage video.

You can get the VAST link the same way as regular Adfox ad tags.

Instead of a code, there will be a link that looks like this:

https://yandex.ru/ads/adfox/168627/getCode?p1=bigha&p2=eojh&puid1=&puid2=&puid3=

You can check the links at a special page.

Use a custom player

  1. Connect the ADSDK library in the <head> tag.

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <script
             type="text/javascript"
             charset="utf-8"
             src="https://yandex.ru/ads/system/adsdk.js">
        </script>
    </head>
    </html>
    
  2. Declare a variable: an object with Adfox parameters.

    var adFoxParameters = {
        adFoxParameters: {
            ownerId: 168627,
            // ID of the tag's parent container <video></video>
            containerId: 'videoParent',
            // Adfox parameters
            params: {
                p1: 'bdcfe',
                p2: 'ekza',
                pfc: 'bupfm',
                pfb: 'frtqn'
            },
        }
     }
    
  3. To start playback, call the play method and pass the Adfox configuration as an argument.

    ya.videoAd.play({
        // Video element
        videoSlot: document.querySelector('#video'),
        // An element for displaying controls. The element must not be positioned statically.
        // You can use the video's parent element.
        slot: document.querySelector('#videoParent'),
        // Loading config and ad playback config.
        config: adFoxParameters,
    });
    

Integration instructions:

Advertising label

You must include an ad label and specify the advertiser and (or) their website when running ads in Russia. To learn more about the label and the banner menu, see Ad label and banner menu in Adfox banners.

To add an ad label to the player where the Yandex Video Ads SDK library is connected, open the Ad label list in the banner parameters and select Ad or Social ad. The ad label will be displayed automatically.

Enable the Show banner menu option if you have provided the advertiser information in the ad campaign parameters. The banner will include a banner menu shown as the icon, displaying the advertiser's information and a token (if ad register is enabled in the banner settings or a third-party token is provided).

The banner menu contains a link to the rules for using recommendation technologies. That is necessary to comply with paragraph 3, section 1, article 10.2-2 of Federal Law No. 149-FZ On information, information technologies, and information protection", dated July 27, 2006.

If you're not using the Yandex Video Ads SDK to display ads, add support of the extension tag to the player in this format:

<Extensions>
        <Extension type="AdTitle">
                <![CDATA[
                        {
                                "show": %banner.ad_label%,
                                "domain": "%banner.domain:jsenc%",
                                "socialAdvertising": %banner.ad_label_social%
                        }
                ]]>
        </Extension>
        <Extension type="AdTune">
                <![CDATA[
                        {
                                "show": %banner.ad_tune%,
                                "token": "%banner.token:jsenc%",
                                "advertiserInfo": "%campaign.advertiser:jsenc%"
                        }
                ]]>
        </Extension>
</Extensions>

Depending on the ad label settings of the banner, the macros may take the following values:

Macro Value
%banner.ad_label% 1 (label is displayed) or 0 (label is not displayed).
%banner.domain:jsenc% Domain (displayed if %banner.ad_label% takes the value of 1 and the Domain field value is set in the banner parameters) or an empty value.
%banner.ad_label_social% “Social ad” label, 1 (displayed if %banner.ad_label% takes the value of 1) or 0 (not displayed).
%banner.ad_tune% 1 (menu is displayed) or 0 (menu is not displayed).
%banner.token:jsenc% Banner token.
%campaign.advertiser:jsenc% Advertiser information.

Examples of the extension tag:

The label with no domain and the banner menu are displayed
<Extensions>
        <Extension type="AdTitle">
                <![CDATA[
                        {
                                "show": 1,
                                "domain": "",
                                "socialAdvertising": 0
                        }
                ]]>
        </Extension>
        <Extension type="AdTune">
                <![CDATA[
                        {
                                "show": 1,
                                "token": "token",
                                "advertiserInfo": "Advertiser information"
                        }
                ]]>
        </Extension>
</Extensions>
The label with the domain and the banner menu are displayed
<Extensions>
        <Extension type="AdTitle">
                <![CDATA[
                        {
                                "show": 1,
                                "domain": "example.ru",
                                "socialAdvertising": 0
                        }
                ]]>
        </Extension>
        <Extension type="AdTune">
                <![CDATA[
                        {
                                "show": 1,
                                "token": "token",
                                "advertiserInfo": "Advertiser information"
                        }
                ]]>
        </Extension>
</Extensions>
The label, domain, and banner menu are not displayed
<Extensions>
        <Extension type="AdTitle">
                <![CDATA[
                        {
                                "show": 0,
                                "domain": "example.ru",
                                "socialAdvertising": 1
                        }
                ]]>
        </Extension>
        <Extension type="AdTune">
                <![CDATA[
                        {
                                "show": 0,
                                "token": "token",
                                "advertiserInfo": "Advertiser information"
                        }
                ]]>
        </Extension>
</Extensions>           
The “Social ad” label with no domain and banner menu are displayed
<Extensions>
        <Extension type="AdTitle">
                <![CDATA[
                        {
                                "show": 1,
                                "domain": "",
                                "socialAdvertising": 1
                        }
                ]]>
        </Extension>
        <Extension type="AdTune">
                <![CDATA[
                        {
                                "show": 0,
                                "token": "token",
                                "advertiserInfo": "Advertiser information"
                        }
                ]]>
        </Extension>
</Extensions>           

Events

The preset Adfox templates have a <TrackingEvents> container with the <Tracking> tags in it. Every <Tracking> element contains the Adfox URI that the video player must use to make a request when a certain event occurs. The event name is passed in the event attribute.

List of events:

  • The start of viewing (start).
  • The video is selected (creativeView).
  • The video is loaded (impression).
  • The first quarter of viewing (firstQuartile).
  • The middle of viewing (midpoint).
  • The third quarter of viewing (thirdQuartile).
  • Full view (complete).
  • Turn the sound off (mute).
  • Turn the sound on (unmute).
  • Pause (pause).
  • View from the beginning (rewind).
  • Continue viewing (resume).
  • Go to full screen (fullscreen).
  • Expand (expand).
  • Collapse (collapse).
  • Go to the next video (acceptInvitationLinear).
  • Click on the Close button, the user's exit (close).
  • Click on the Skip ad text bar (skip).
  • Click on the Go to the advertiser's website text bar (addclick).
  • Error (Error).
  • Progress: Available starting with VAST 3.0.

Response if there's no ad

When there's no suitable ad to serve, Adfox returns the following XML:

  • InStream banner type:

    <?xml version=”1.0”?><nobanner></nobanner>
    
  • InPage banner type:

    <?xml version=”1.0”?><VAST version="2.0"/>
    

To add a backup ad for VAST player ads, you need an ad request link. Put this link in square brackets in the VASTAdTagURI block:

<?xml version="1.0" encoding="UTF-8"?>
<VAST version="2.0">
    <Ad id="%placeId%">
        <Wrapper>
            <AdSystem>Adfox.ru</AdSystem>
            <VASTAdTagURI>
                <![CDATA[//yandex.ru/ads/adfox/XXXXXX/getCode?p1=xxx&p2=xxx&pfc=a&pfb=a&plp=a&pli=a&pop=a&puid1=%userValue1%]]>
            </VASTAdTagURI>
            <Impression></Impression>
            <Creatives></Creatives>
        </Wrapper>
    </Ad>
</VAST>

If you need to pass additional parameters to the request code forwarded, use macros:

  • For values of user characteristics: puidN with the %request.puidN% value, where N is the characteristic number. For example, &puid1=%request.puid1%.
  • To send a referer: dl with the %request.referrer:urlenc% value. For example, &dl=%request.referrer:urlenc%.

Copy the code and install it in the XML code of the placement's backup ad and/or banner type.

Contact support

Send an email