Kaltura API for detailed usage statistics?

TL;DR - Is there a Kaltura API function that can tell every time media playback was started, when it happened and which LMS course ID was associated with it?

Details - At Univ. of Michigan, we want to generate reports and a dashboard showing the usage of Kaltura in our LMS. So far, we have a prototype that’s based on data from the Caliper events Kaltura sends to our eventstore. The MediaEvent objects with the Started action contain the ID number of the LMS course associated with each event. Using that and the eventTime of each event, we’re able to produce data with columns hourly timestamp, course ID number, and the number of media Started events that occurred for that course in that hour.

That is, the columns we’re producing from Caliper events are:

  • event_hour_utc – a string like “2020-03-03 03” (meaning 3AM on 03 March)
  • course_id – the numeric Canvas course ID
  • event_count – the number of media start events for that course in that hour

This seems to work well, but when we compare the results of this data with that in the KMC, we find there are discrepancies. For any given time period, the statistics in the KMC may say there are either more or less media playback requests. So we’d like to try to get similar data from the Kaltura API and compare the results.

Browsing through the Kaltura API, it looks like a possible source of data is in the “Analytics Reports” entry. I’ve been trying various options in this “Workflows” tool:


Specifically, using a report type of “CONTENT_INTERACTIONS” returns the columns:

  • object_id – media ID, like “1_5jmg0k97”
  • entry_name
  • count_plays – is this analogous to Caliper media started event?
  • count_edit – this and the following columns are probably not useful to us
  • count_viral
  • count_download
  • count_report

There’s no time included in the data, but the required report parameters are the starting and ending date. It appears to only work with full days. (I will try using partial days and see what happens.) If it is full days only, it won’t fit our use case. Maybe some other API entry or a different report within this one will give hourly data.

Also missing from this data is the Canvas course ID number. However, we already have a mapping of the media ID (“object_id”) to LMS course ID number from the Kaltura API as part of another report. Unfortunately, that data has a one media ID to multiple course IDs relationship, whereas similar data from Caliper events is a one-to-one relationship. That’s because when the user starts media from the LMS, the emitted event includes the specific course ID the user was working with at the time. That means the data from the Kaltura API will probably artificially inflate the activity on each course. That is, if the media ID in this data is “1_5jmg0k97”, for example, we don’t know how much of that activity applies to course 11111 and how much to course 22222, the two courses that contain that Kaltura media.

Is there a better way for us to get data from the Kaltura API that tells every time media playback was started, when it happened and which LMS course ID was associated with it?

Hello @lsloan,

report.getTable(), report.getTotal() and report.getGraph() all accept a KalturaReportInputFilter object.
This object has the following members that may be of interest:

  • fromDay/toDay (format is %Y%m%d)
  • fromDate/toDate (Epoch/UNIX timestamp)
  • timeZoneOffset (in my case, my TZ is BST which makes the value -60)
  • interval

Since the KMC analytics dashboard (https://github.com/kaltura/analytics-front-end) also utilises the very same APIs in order to fetch data, you may use the built-in HTTP sniffer in your browser (aka developer tools->network) to see the exact request being made per analytics view, as well as the parameters. For example:

reportInputFilter: {objectType: "KalturaEndUserReportInputFilter", fromDate: 1587769200, toDate: 1590361199,…}
fromDate: 1587769200
interval: "days"
objectType: "KalturaEndUserReportInputFilter"
timeZoneOffset: -60
toDate: 1590361199

These will typically be multirequests. You can filter based on api_v3/service/multirequest?format=1&clientTag=kmc-analytics in the network tab.

Hope this helps,

Yes, that is helpful. Thanks.

I was wondering, though, do “fromDate/toDate” use the specific hours of the day, or does it round the results to the nearest full day? That is, if I specify a “from” timestamp for 13:00 yesterday and a “to” timestamp for 14:00 yesterday, will I get data for just that hour, or will I get data for the whole day?

Hello @lsloan,

If you set interval to 'hours' you should get the exact range you had requested in fromDate/toDate.
Be sure to also set the correct timeZoneOffset.

Thanks. I’ll check the interval I’m using.