Time on last page / heartbeat timer

Hi,
I would like to know the time spent on the last viewed page of a visit.
The custom dimensions are enabled which results in a filled time spent column. The heartbeat timer is also on.

when I switch to another tab the time_spent column is filled but when I close the browser the time spent on the last page is not filled.
How/what should I set to measure (actual)time spent on the last viewed page of the visit.

Hi @Jay-jay

Nothing abnormal there, as when you switch tab or navigate to another website, the browser can do the sendbeacon, whereas if if is killed, it can’t!
One solution could be to send periodically a ping to Matomo. But this can overload the network.