Our API includes options to retrieve a wide range of statistics. We track video/channel/player views, storage/traffic usage and video engagement. This can be very useful for providing video statistics inside your application or CMS. In this tutorial, we'll look into requesting and formatting two stats: video views and video engagement.
With the /videos/views/ class, it is possible to retrieve:
Data can be retrieved both for specific videos, or for the whole account. Next, a simple Flash or JavaScript chart can be used to display the data in a user-friendly manner.
Here is an example of an account's total number of views, for a certain date range. The example uses the same simple Flash chart as can be found in our Dashboard. The code of this example can be downloaded as part of our PHP Examples ZIP.
Instead of video views, it is fairly easy to display one of the other metrics. The chart can be scaled to different dimensions and set to a different color. And a datepicker in combination with an XMLHTTPRequest will allow for nice updates of the daterange without reloading the page.
The /videos/engagement API class allows for retrieval of video engagement data. In other words, it allows you to display how many times certain sections of a video have been watched. This data is useful to identify in a video:
For now, video engagement is only available globally for a video and not for a given date range. We will start offering this as well though, so you can e.g. compare engagement data before and after re-uploading a new edit of a video.
Here is an example of the engagement chart of a small video. This example also uses the Flash chart from our dashboard. A few lines of JavaScript are added to let the chart and player interact. The code of this example can be downloaded as part of our PHP Examples ZIP.
Examples of other videos you can see are LJSVMnCF and sFLjZ5Ne.
Again, the dimensions and colors of the chart can be easily changed. The player is embedded using a default Bits on the Run embed code. It uses the Simple Skin. Alternatively, you could also hide the controlbar of the player, since the chart offers video timeline scrubbing by itself.