Floating-Dartists / matomo-tracker

A fully cross-platform wrap of the Matomo tracking client for Flutter, using the Matomo API.
https://pub.dev/packages/matomo_tracker
MIT License
26 stars 28 forks source link

Accurately measure the time on the last page #78

Closed EPNW-Eric closed 1 year ago

EPNW-Eric commented 1 year ago

There is a well known issue that the time of the last page visit is tracked as 0 by Matomo: How do I accurately measure the time spent by visitors on my pages, including the time spent on the last page of their visit? (using the heart beat timer)

If I understand it correctly, this is because once a visitor leaves the app and no longer makes any page visits, there is no way for Matomo to track how long their last visit actually was. Therefore, Matomo is unable to provide accurate information on the duration of the last page visit.

Luckily, there is already a solution: It's heartbeating with the ping parameter. By using this mechanism, a request is made in a fixed interval to tell Matomo that the current visit is still ongoing.