API - To get time spent in each actions for a period rather than for the whole page visit

Hi,

Would like to get the time spent in each actions for a period using API. We’ve been using VisitsSummary.get, but it seems to be giving the total spent for the visit instead of time spent in actions.

Here for a page visit, we have multiple actions in a page view and the total time spent is 40 mins 30 secs.

What we are trying to do is getting the time spent in few pages only, using custom variables and segmentation.

https://matomo.domain.tld/index.php?
method=VisitsSummary.get&
idSite=11&period=range&
token_auth=***********&
format=json&module=API&
date=2019-08-12,2019-09-12&
segment=userId==59;customVariablePageName1==info;customVariablePageValue1=@var:2396>
{
"nb_visits": 1,
"nb_actions": 21,
"nb_visits_converted": 0,
"bounce_count": 0,
"sum_visit_length": 2430,
"max_actions": 21,
"bounce_rate": "0%",
"nb_actions_per_visit": 21,
"avg_time_on_site": 2430
}

But only few actions are matching the segment that is sent along with the API.

customVariablePageName1==info;customVariablePageValue1=@var:2396>

But the response is providing the overall visit time spent.

Is there anyway to get the time spent in each actions rather than for the whole page visit ?
Which API should be used for this use case, if it is available ?

Thanks,
Subu

Action With Custom variable

Action Without custom variable

I have also the same issue ans posted: https://forum.matomo.org/t/time-tracking-as-cta

1 Like

I need the same feature. Tracking time spent on a segment/dimension/variable.

I was thinking about breaking visit into multiple visits, each one with a separate value for a dimension/variable. It should work quite well with default reporting.

Ideally though I’d like to make it hierarchical, such as: time spent on pages: /main 10sec, /main/first 2sec , /main/second 1sec, ; at the same time it would be great to keep original visits intact.

Similar questions:

Issues:

1 Like

@Swaminathan_Subraman I managed to get average time for a custom dimension. See How is "Average Time on Dimension" computed?

Still wondering how is it computed exactly.