Ajax polling for more accurate time on page

Now piwik calculates the time spent on a page based on the differnt timestamps of two pages. This works great, but if a visitor only visits one page, visit duration is 0 seconds, also the last visited page has a duration of 0 seconds. To get more accurate data, it would be intereseting to let the piwik tracker poll the server each 5 or 10 seconds. Alternatively, piwik could add an event listener to the onunload event, and send a call.

see Support Ping requests to report a better 'time on page' · Issue #2041 · matomo-org/matomo · GitHub