How do I get the time elapsed between two actions or two events in the same visit or even across multiple visits?
Currently Matomo does not process reports showing the time elapsed during between two specific actions or pages or events.
There are workarounds and ways you can measure the time spent between two actions.
If you need to measure the time between two actions done on the same page (for example clicking two different buttons on the same page), then it may work for you to 1) track a custom Event where for example « Event category » is ‘Elapsed time’ and « Event Action » is ‘Time to click button X’ and 2) manually keep track and store in the « Event Value » the actual time you want to measure as an integer, so the elapsed time in seconds (or even in milliseconds if you want more precision). Then in Matomo > Behavior > Events, you would see all the times you’ve tracked, and for each: the sum of all elapsed times, the average elapsed time, minimum and maximum elapsed time.
If you need to measure the time spent between two actions done on separate pages or even in separate visits, it may be easier to get the data directly from the database. See our database schema guide to see the description of the database structure.. In particular you can calculate the time spent between two actions by looking in the log_link_visit_action
table at the field server_time
column, which contains the datetime the action was tracked in the UTC timezone. Then by getting the difference between the two rows of the two actions, you will get the time elapsed between the two.