-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
I believe there is an issue with how ping requests are processed.
According to the source visit_last_action_time
holds the visit´s end time:
/**
* This dimension holds the best guess for a visit's end time. It is set the last action
* time for each visit. `ping=1` requests can be sent to update the dimension value so
* it can be a more accurate guess of the time the visitor spent on the site.
*
* Note: though it is named 'visit last action time' it actually refers to the visit's last action's
* end time.
*/
Looking at how the PingRequestProcessor (https://github.com/matomo-org/matomo/blob/3.x-dev/plugins/Heartbeat/Tracker/PingRequestProcessor.php) handles hearbeats, it seems it does not update log_visit.visit_last_action_time
, it only updates log_visit.visit_total_time
.
log_visit.visit_last_action_time
is only updated if an action is sent. I think the issue is that PingRequestProcessor
sends an empty Actions
:
https://github.com/matomo-org/matomo/blob/2.16.0-b6/plugins/Heartbeat/Tracker/PingRequestProcessor.php#L24-L29
When viewing a users visits, the "x actions in " is correct, as it uses log_visit.visit_first_action_time
+ log_visit. visit_total_time
.
For us, this becomes an issue an issue when using CustomReports and Server Time - Hour/Minute (End Of Visit)
, as it using log_visit.visit_last_action_time
(https://github.com/matomo-org/matomo/blob/3.x-dev/plugins/CoreHome/Columns/VisitLastActionMinute.php#L32) to determine the visis end time. This occurs since ping requests does not update log_visit.visit_last_action_time
. With the current code, it is not possible to determine when a visit ended for SPA apps, since it seems only an action can that trigger an update of log_visit.visit_last_action_time
.
I'm not sure if this is a bug in the PingRequestProcessor, or an issue with how VisitLastActionMinute
is expected to compute the visits end time.