What is the best way to calculate the total time spent by a registered user on the site? ... under these conditions 1) The user logs normally 2) The user can simply close the browser 3) The user can log in automatically next time he comes back.
I think the best way to do this is to find the time spent by the user on each page and add them to their total time to check the entire site but I do not know how to implement it. Please ... please help
You can not find that it takes the right time, as long as That he is not logged out. However, he will be browsing the site while logging out.
The approximate way to do this will be to set the start time in the session and increase the time in each page.
If the user comes to your site on time for the first time, then you
- create a session and enter the start time
- Add As a total time 0
For all subsequent requests, you
- check the start time and compare it with that time and get the difference
- Add to that time in total time
This method will not spend that user on the last page. But it will give you something to work with
Comments
Post a Comment