1

I would like to measure time spent by a user on a process flow across multiple sessions.I have seen some blogs for single session,but multiple session looks quite complected.

Let's say I want to track time spent for a process that starts at page A goes through B to C.C is final exit point. But user can save the process at page B and exit,then come back again after some time (may be a day or two) and then continue to complete the process.

What approach should I take to calculate total time spent on the process and no of sessions? How do I calculate it?

Any idea,response will be highly appreciated.

Sinha
  • 773
  • 2
  • 16
  • 34

1 Answers1

0

There are many ways to approach this problem. One accurate/reusable approach would be to track the time spent on the page using JavaScript, and store that time in a database entry for that user each time he/she continues the process. With each subsequent session, you start counting the time spent again and append it to the existing time spent that you had previously stored. For example:

User John logs in and starts on page A for 2 minutes. He continues to page B, spends 1 minute there, and then logs out. When logging out, you tell your back-end "User John spent 3 minutes on the process", storing the value in a database entry tied to user John. The next time John logs in, he spends 2 more minutes on page B, and finishes page C in 4 minutes. Once complete (or on logout), you again send a request to your back-end saying "User John spent 6 minutes on the process", adding that to the existing value.

As a shameless plug, I'd recommend using a JavaScript library that I put together to help keep track of time spent by the user. It tries to only count the time that the user is 'actually' interacting with your website, and not time that they have gone idle or switched tabs or gone to another application. It is on GitHub here: https://github.com/jasonzissman, with a related StackOverflow answer here: How to measure a time spent on a page?.

Community
  • 1
  • 1
jason.zissman
  • 2,750
  • 2
  • 19
  • 24