0 second visits

It seems like many visits are counted as lasting 0 seconds, if that person doesn’t visit another page…

Is there a solution to this problem?

Hi there, see feature request: Support Ping requests to report a better 'time on page' · Issue #2041 · matomo-org/piwik · GitHub

Thanks, I’ll follow the feature request over there.

Just curious: Do you know if there are plans to implementing it in the near future?

I had the same problem and used this:


...
<!-- End Piwik Code -->

<script type="text/javascript">
window.onunload = trackUnloadPage;
function trackUnloadPage()
{
_paq.push(['trackPageView','Leaving']);
}
</script>

Maybe it works for you too. :wink:

Thanks for sharing @rddr! But if the solution is that simple, surely the developers would have implemented it long time ago? Or perhaps they just didn’t think of solving it like that? Perhaps Matt can share his point of view on this solution?

The issue has been added to the “Long Term” milestone on Github:

Good news! Starting in Piwik 2.14.0 the new feature of tracking how long users stay on page (using a Heart beat timer “ping” request) has been released. You can enable it with


_paq.push(['enableHeartBeatTimer']);

By default, a ping request will be sent every 15 seconds. You can specify a custom ping delay (in seconds) by passing an argument, eg,


_paq.push(['enableHeartBeatTimer', 10]);

Learn more in the Tracking JavaScript guide: JavaScript Tracking Client: API Reference - Matomo Analytics (formerly Piwik Analytics) - Developer Docs - v3

Update today to enjoy this new feature (as well as many other improvements!)

That is amazing, thank you for adding this feature! Do I need to insert it manually in all tracking scripts on my web sites, or will it be enabled just by upgrading to Piwik 2.14.0?