XML-banner

1. Banner summary

ID Number: 03V016.
Description: Downloaded XML file with a banner.
Type of the code: xml.
Examples: banner Soloway.
Third party tracking: flash banner preparation for further AdRiver pixel insertion.
Specification: this banner is an XML-file which is formed by AdRiver in reply to request of a banner. Video player displays banner according to all ad plaсe’s parameters which are contained in the XML-file. The following banners can be displayed on the ad place in the video player:
  • .flv (film ads);
  • .swf (flash ads);
  • .gif, .jpeg, .png (image ads).
All files except flv-files can be downloaded into AdRiver or can be stored at another server. Flv-files can be downloaded only from a location. XML-banner can be used in Flash-sites.

2. Downloading of a banner and generation of an HTML code

2.1. Downloading of a banner

  • Add a banner special —> special —> xml banner.
  • Click on Загрузить баннер.
  • Download files for the banner. Flash-movie and images can be downloaded into AdRiver or stored at another server. Flv-files can be downloaded only from a location.
  • If need, enter a pixel-audit from other system.

2.2. Generation of an HTML code

  • Generate an html-code for banner.
    A code example for publishers
    
    <!--  AdRiver code START. Type:xml banner Site: example PZ: 0 BN: 0 -->
    Ролик:http://ad.adriver.ru/cgi-bin/erle.cgi?sid=94499&target=top&bt=54&pz=0&rnd=1734737595
    Клик:http://ad.adriver.ru/cgi-bin/click.cgi?sid=94499&bt=54&pz=0&rnd=1734737595<!--  AdRiver code END  -->
    A code example for advertising agencies
    
    <!-- AdRiver code START: код для баннера; AD: 217104 "XML-video";   сценарий   ID 417286 "XML-video"  баннер ID 775141; xml banner -->
    Ролик:http://ad.adriver.ru/cgi-bin/erle.cgi?sid=1&ad=217104&bt=54&pid=417286&bid=775141&bn=775141&rnd=1426200797
    Клик:http://ad.adriver.ru/cgi-bin/click.cgi?sid=1&ad=217104&bt=54&pid=417286&bid=775141&bn=775141&rnd=1426200797
    <!-- AdRiver code END -->
  • You are needed only «Ролик» part of the code. Replace a random number (highlighted in red) by ![rnd]. For example:
    
    Ролик:http://ad.adriver.ru/cgi-bin/erle.cgi?sid=94499&target=top&bt=54&pz=0&rnd=![rnd]
    
  • Insert this link into your video player.

2.3. Downloading in a banner a custom XML file

General XML file AdRiver contains the following data:

  • image location (if downloaded);
  • flash-movie location (if downloaded);
  • flv-video location (if downloaded);
  • two pixel-audits from other system.

The general lib has built-in functions for clicks and events.

If you need an individual list of options, you can download in AdRiver a custom XML file.

If you want to have a personal webpage on www.adriver.ru site with making a custom XMl file, please email us at: account@adriver.ru. Please, specify a list of the text boxes and their values by default in your e-mail.

To download a custom XML file, add a banner generic XML and download a custom index.xml and other necessary files.

General libs adriver.xml.as for ActionScript2 and getObjectFromXML for ActionScript3 are appropriate for generic XML banner. When using general libs XML-content is available in property o.xml.

3. A video player preparation

3.1. A video player on ActionScript2

Download the sources for video player and the adriver.xml.as lib. Save in an one folder adriver.xml.as file and the video player sources.
The example of ActionScript2-code for video player:


#include "adriver.xml.as"

Stage.scaleMode = "noScale";
Stage.align = 'TL';
btn._visible = false;

var conn = new NetConnection();
conn.connect(null);
var stream = new NetStream(conn);
vid.attachVideo(stream);

function onXMLLoad(o){
    btn.onRelease = function(){
        o.makeClick();
    }

    o.sendPixel(o.pixel1);
    o.sendPixel(o.pixel2);

    if (o.flv){
        stream.play(o.flv);

        btn._visible = true;
    }
    else if (o.swf){
        var mcLoader = new MovieClipLoader();
        mcLoader.addListener({onLoadInit:function (mc:MovieClip){
            mc._lockroot = true;
        }});
        mcLoader.loadClip(o.swf + '?link1=' + escape(o.ar_cgihref), mov);
    }
    else if (o.image){
        var mcLoader = new MovieClipLoader();
        mcLoader.addListener({onLoadInit:function (mc:MovieClip){
            btn._visible = true;
        }});
        mcLoader.loadClip(o.image, mov);
    }
    else{
        trace('default image AdRiver');
    }
}

new getObjectFromXML("http://ad.adriver.ru/cgi-bin/erle.cgi?sid=94499&target=top&bt=54&pz=0&rnd=![rnd]", onXMLLoad);
  • Replace the link (highlighted in red) by your link from item 2.2.
  • You could execute some commands if there is AdRiver image in a system reply.

Description.

  • For showing a banner the function getObjectFromXML is called. The first parameter is the link to a banner, the second parameter is the link to onXMLLoad function.
  • Function onXMLLoad(o) is executed after the complete loading of an XML file. Function argument (in this example it’s called «о»; a developer can choose another name) is the object with necessary set of functions for click, call of the events, file locations, and counters of other system.
  • For click through a banner the function o.makeClick() is called (in the example this function is registered on the btn button). If necessary, it is possible to define alternative URL in a video player. For example:
    
    o.makeClick('alternative URL, should start with 'http://')
    
  • For counter of other system the function o.sendPixel() is called (o.pixel1 is the link to the first counter, o.pixel2 is the link to the second counter; they are set in the appropriate text boxes in the AdRiver interface when loading a banner). In the example both counters are called. If no one counter is defined then function o.sendPixel calls nothing.
  • Depends on which files have downloaded they can be shown (o.swf is a reference to a flash-movie, o.image is a reference to an image, o.flv is a reference to a flv-movie). In the example it’s inspected if a flv-movie is downloaded, and if yes then it will be shown. If not, it’s inspected if there is a flash-movie or an image and if file is found, then it will be shown. When file has loaded it is scaled and also the button for click is displayed (function onLoadInit).

The function o.sendEvent can be called in video player for events. The function attribute is a number. There are events from 1 to 9, event number 0 is called automatically, when an XML file is completely loaded.

For events from 1 to 9 you can set your own metrics. For example:

  • event number 1 is click on «skip ad»;
  • event number 2 is viewing 10 sec;
  • event number 3 is viewing 15 sec;
  • event number 4 is viewing 20 sec;
  • event number 5 is viewing 25 sec;
  • event number 9 is viewing the last frame of a flash-movie.

Insert the call of appropriate events in the required frames of your video player:

  • o.sendEvent (1)
  • o.sendEvent (2)
  • o.sendEvent (9).

After setting this functions in the video player you can count these events automatically for banners.

 

Options that can be used in video player:

  • o.image — a reference to an image;
  • o.swf — a reference to a flash-movie;
  • o.flv — a reference to a video;
  • o.pixel1 — a reference to the first counter;
  • o.pixel2 — a reference to the second counter;
  • o.sendEvent — the function for events. The function attribute is a number. There are events from 1 to 9, event number 0 is called automatically, when an XML file is completely loaded;
  • o.sendPixel — the function for counter of other system. The function attribute is a link (string);
  • o.makeClick — the function for click. Can take URL as an attribute: o.makeClick(‘alternative URL’).

3.2. A video player on ActionScript3

Download the sources for video player and the getObjectFromXML lib. Save in one folder the video player sources and the «adriver» folder that contains the getObjectFromXML file.

Videoplayer ActionScript3-code example:


import adriver.getObjectFromXML;
import flash.net.NetConnection;
import flash.net.NetStream;


btn.enabled = false;
btn.x = -1000;

var conn = new NetConnection();
conn.connect(null);
var stream = new NetStream(conn);
vid.attachNetStream(stream)

function onXMLLoad(o){
    btn.addEventListener(MouseEvent.CLICK, function(e){
        o.makeClick();
    });

    o.sendPixel(o.pixel1);
    o.sendPixel(o.pixel2);

    if (o.flv) {
        stream.play(o.flv);

        btn.enabled = true;
        btn.x = 0;
    }
    else if (o.swf) {
        var l:Loader = new Loader();
        l.load(new URLRequest(o.swf + '?link1=' + escape(o.ar_cgihref)));
        mov.addChild(l);
    }
    else if (o.image) {
        var loader:Loader = new Loader();
        loader.contentLoaderInfo.addEventListener(Event.INIT, function(e){
            btn.enabled = true;
            btn.x = 0;
        });
        var request:URLRequest = new URLRequest(o.image);
        loader.load(request);
        mov.addChild(loader);
    }
    else {
        trace('default image AdRiver')
    }
}

new getObjectFromXML("http://ad.adriver.ru/cgi-bin/erle.cgi?sid=94499&target=top&bt=54&pz=0&rnd=![rnd]", onXMLLoad);
  • Replace the link highlighted in red by your link from item 2.2.
  • You can execute some commands if there is AdRiver image in a system reply.

4. Requirements

Names of the files can consist of numbers, latin letters or underscore symbols only and can’t contain any russian letters, space symbols, quotes or other special symbols.

5. The limit of the file size for banners in AdRiver

  • gif, jpeg, png-files (img width x height banners on AdRiver) — 600К;
  • swf-files (flash width x height banners on AdRiver) — 600K;
  • other file types — 600K;
  • for multicomponent banners the limits are checked for each one component.

To download in the banner files with extra-limit size you can use the text box Расположение на стороннем сервере, in which you should insert the pathname to an external server.

For the banners that can’t be loaded from an external server it is possible to increase the limits of the file size. It comes to agreement with sales and support departments.

Last modified on 29.03.2016