MediaAnalytics: How to get the media detail of a video by export feature

Hello,

I have been using Matomo x Media Analytics plugin to use media insights. I want to integrate the Media details information which are “Time spent watching” with bar chart into our service.

Here is an detail article including the time spend watching info.
https://matomo.org/blog/2017/02/media-analytics-piwik-gives-insights-need-measure-effective-video-audio-marketing-part-2/

So is there any ways to get the data or bar chart from API as export feature?
I try to find the docs, but I still didn’t find yet.

Thanks.

Hi,

Yes, you can use ImageGraph Metadata: API Reference - Matomo Analytics (formerly Piwik Analytics) - Developer Docs - v3

Along with the Media Analytics module Reporting API Reference: API Reference - Matomo Analytics (formerly Piwik Analytics) - Developer Docs - v3 specifying the sum_total_time_watched column.

An example could be:

https://example.com/index.php?module=API&method=ImageGraph.get&idSite=1&apiModule=MediaAnalytics&apiAction=get&token_auth=xyz&graphType=verticalBar&period=month&date=last10&width=500&height=250&columns=sum_total_time_watched

Hi,

Thanks for your response.

Sorry for the lack of information.

Actually, we would like to use the MediaAnalytics plugin to generate a chart that displays the number of users who left the video at time=n seconds. I think we need to use the media_spent_time segment in order to do that.

We would like to get data from the API to generate a graph similar to the ‘Time spent watching’ graph created by this url:

http://mydomain.com/index.php?module=CoreHome&action=index&idSite=1&period=day&date=yesterday&updated=1#?idSite=6&period=range&date=2018-08-01,2018-10-09&category=MediaAnalytics_Media&subcategory=MediaAnalytics_TypeVideo&popover=RowAction$3AMediaDetails$3AgetVideoTitles$3A66$3A$257B$257D

We need to generate charts in our CMS by getting data from the API.

We need accurate data and if possible we would like to avoid to use time ranges like segment=media_spent_time>0;media_spent_time<7

Currently, we use this command, but we would like to reduce the number of calls to the API.
At time = 35 seconds, X users left the video:

curl -X GET "https://mydomain.com/index.php?\
period=range&date=2018-01-01,2018-10-01&\
module=API&\
segment=media_spent_time==35;media_title==dummy_video\
&idSite=1&\
method=MediaAnalytics.getVideoTitles&format=JSON&\
token_auth=xyz" -v | python -m json.tool

As our videos are about 10 minutes long, we can’t call the API 600 times…

Any help would be highly appreciated.

Thanks

Can you confirm the type of graph you would like is similar to below?

Hi,

Thanks for your response.

Yes, the graph is what we want to get.
Furthermore we would like to get the data from API.

Regards,
Yusuke

Hi,

Is there any way to get the each range of data from API for the chart?

Thanks.

Hi Sorry for the delay,

You would use the following request to get a similar chart:

https://example.com/index.php?date=2018-09-11&amp;expanded=1&amp;filter_limit=100&amp;filter_truncate=499&amp;format=JSON&amp;format_metrics=1&amp;idSite=1&amp;idSubtable=1&amp;method=MediaAnalytics.getVideoTitles&amp;module=API&amp;period=month&amp;secondaryDimension=spent_time&amp;token_auth=XYZ

where idSubtable needs to be set to the correct id that matches a specific video.

Is there any way to get the each range of data from API for the chart?

Do you mean for each second?

Hi Jason,

Sorry for the delay response.

The API url you gave me was I was looking for. It worked fine on our environment. It will be able to customize our chart using it.

Thanks so much.

Regards,
Yusuke

1 Like