Couldn't you just saved the time when the user opened the page in the cookie, and then when he leave the page, just calculate the difference between the time when he left, and the time when he opened the page? This way you will get the exact time spent on the site without the overhead that setInterval applies.
Couldn't you just saved the time when the user opened the page in the cookie, and then when he leave the page, just calculate the difference between the time when he left, and the time when he opened the page? This way you will get the exact time spent on the site without the overhead that setInterval applies.
Yeah, We can achieve it in this way also