I need to capture the time a user spends on a page in my application.
I wish the time is in hour: minutes: seconds.
Using this I can track the user activities. I do some research but didn't found anything useful.
Is there any way to track the time a user spends on a page?
use a Stopwatch
Stopwatch timer;
protected override void OnAppearing()
{
timer = new Stopwatch();
timer.Start();
}
protected override void OnDisappearing()
{
timer.Stop();
TimeSpan ts = timer.Elapsed;
string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}",
ts.Hours, ts.Minutes, ts.Seconds);
}