Tracking time spent on page

Hi all,

I am trying to write a plugin that would track the time the user spent on a page.
What would be the best way ?
I was thinking of storing a cookie with timestamp and url and retrieving it on next page process or with JS onbeforeunload ?

Any good advice is welcome.


1 Like