1. Help Centre
  2. Getting Started

API for measuring VTR

How to implement Video VTR (view-through-rate) and Time In View tracking to HTML5 creative in the Adnami Platform.

Add the below javascript snippet into your ad code (where “video” is a reference to the HTML5 video element to be tracked). Note that our API is only available to a creative once it is hosted on Adnami, so there is a bit of offline fallback logic to prevent errors when testing locally.

try{

      __adnamiAdsAPI.v1.tracker.trackVideoElement(video);

      __adnamiAdsAPI.v1.videoController.playIfInview(video);

}catch(e){

    console.log(`Failed to apply video tracking to ${video} - Offline`);

}