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


(Y Tanaka) #1

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.


(Jason) #2

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

(Y Tanaka) #3

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


(Jason) #4

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


(Y Tanaka) #5

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


(Y Tanaka) #6

Hi,

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

Thanks.


(Jason) #7

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&expanded=1&filter_limit=100&filter_truncate=499&format=JSON&format_metrics=1&idSite=1&idSubtable=1&method=MediaAnalytics.getVideoTitles&module=API&period=month&secondaryDimension=spent_time&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?