ohadsas
ohadsas

Reputation: 479

How to use ad impression event with videojs_5 vast-vpaid plugin

How can i track ad impression using videojs vast-vpaid plugin? Ad impression will always be fired when the ad started? Is there a way to track ads duration events? (first-quartile,second,etc) Will it be different tracking event for VPAID ads?

This is an example of my code:

</head>
<body>
<video id="example_video_1" class="video-js vjs-default-skin"
       controls="" preload="none" width="300" height="300"
       poster="http://vjs.zencdn.net/v/oceans.png">
</video>
<script>
    var player;
    $(document).ready(function() {
        player = videojs('example_video_1', {
            techOrder: ['html5','flash'],
            //autoplay: true,
            sources: [{
                type: "video/mp4",
                src: "http://vjs.zencdn.net/v/oceans.mp4"
            }],
            plugins: {
                vastClient: {
                    adTagUrl: "http://ssp.lkqd.net/ad?pid=2000&sid=20497&env=3&format=1&width=[WIDTH]&height=[HEIGHT]&dnt=[DO_NOT_TRACK]&output=vast&rnd=[CACHEBUSTER]&pageurl=[URL_ENCODED_PAGEURL]",
                    adsCancelTimeout: 3000,
                    adsEnabled: true
                }
            }
        });

        player.on('vast.adStart', function () {
        });

        player.on('vast.contentEnd', function () {
        });

    });
</script>
</body>
</html>

Upvotes: 2

Views: 2160

Answers (1)

zyexal
zyexal

Reputation: 1579

There are currently two issues open regarding events:

#115 add trigger for quartiles
can a trigger be added for each of the vast quartiles.

#194 Quartiles and Impression events while playing Vast/Vpaid (yours)
How do i listen to Quartiles events while playing Vast/Vpaid? How do i listen to an Impression event?


The plugin handles events internally. Meaning it's not build to trigger each event except for these documented under Plugin events

... with an exception:

Some VPAID events like ...

vpaid.AdVideoFirstQuartile
vpaid.AdVideoMidpoint
vpaid.AdVideoThirdQuartile

are receivable.

VAST events, afaig Nope.


Regarding vast.adStart vs. AdImpression (btw: same for VPAID) you can “emulate” the behaviour if you unregister the event after its first occurrence:

player.on('vast.adStart', function (e) {
    // do something ...
    player.off('vast.adStart');
});

Specs and the fact that we don't have an vast.impression event telling us why:

2.2.5.4 Impression vs. “Start” Event
Impression tracking URIs should be used to track when the first frame of the ad is displayed. However, an ad may be made up of multiple creative. If the advertiser wants to track when individual ad creative are started in addition to tracking the ad impression, the VAST response should include a “start” event under the element for the creative to be tracked. See the tracking notes under each relevant ad format in sections 2.3.1 – 2.3.5 for details.

Last but not least, for VAST and VPAID complete events you might want to use vast.adEnd instead of vast.contentEnd


I know the answer is unsatisfying, but it is like it is - at least for now. You might want to implement something yourself. If so, pls share ;)

Have a nice day.

Upvotes: 1

Related Questions