jasonzissman / TimeMe.js

A JavaScript library to accurately time how long a user views a web page, disregarding idle time and time when the tab or window is minimized.
MIT License
592 stars 124 forks source link

getTimeOnCurrentPageInSeconds returns huge value #79

Open jfrank14 opened 7 months ago

jfrank14 commented 7 months ago

TimeMe works beautifully and we're using as directed to measure the amount of time people are using our site. We set a timer on page load and on various page events we post this back to the server and record it in a database.

Very occasionally, we see enormous times in these logs, like on the order of 7 million seconds, which is about 2 months. Since the activity timeout is 5 seconds, I don't think there's any way that this could be a true time spent on the page. Even if you left the page up and never timed out, it's hard to imagine a page staying alive for that amount of time.

And sometimes we'll see a time like 700,000 seconds, and then subsequent activity a minute later of 700,060 seconds, so it seems like TimeMe is somehow being initialized to this extreme value, and working correctly thereafter.

It's always probable that this is a bug in my code, but so far I don't see it.