I am building some custom logging code to track how people use our web application. I am doing this is in the Site.master page under ASP.NET MVC, but my question is actually more generic. What I would like to do is determine how long someone spends on a particular page.
I can track when people hit a certain page, but obviously I can't really tell how long they spend on a page through any server side code. What I am doing now is just calculating things this way:
Page A is hit at time T0 Page B is hit at time T1 therefore, someone most likely spent T1 -T0 time on page A.
Now, people can walk away from their computer, or whatever, so I have an arbitrary threshold of 120 seconds right now. If T1-T0 is > 120, then I just log a token that means "unknown"
This works, but seems pretty hack-y.
Does anyone have a better suggestion? I don't need code, just an algorithm.