I have a struts based web application. I need to determine the time spent by a user on each page of the application. This is so I can create a report for each customer who browses through my application with the time he spends on each page. Currently I am planning to extend ActionServlet and include log statements that log start and end of each request as well as the users session id(to nuiquely identify a customer) Is there a standard/better way of doing this?
Normally the time your server takes to process a request, from start to finish, should be only a few seconds. Now, if I were a user of your system and you told me that I spent 1.377 seconds on page X, I would be bemused, because after your server showed me page X I actually looked at it for a couple of minutes before I clicked on the link to page Y.
So I think you need to clarify what time it is that you are trying to measure.
Joined: Feb 08, 2006
It will be tough. You can probably implement some code that will track the time between when a page is shown and when the user clicks a button or link on that page. You won't be able to measure how much of that time the user spent actually looking at the page versus getting a cup of coffee, answering a phone call or the such. Also what if the user never clicks on a link or button?
I know that there are third party products that try and produce these types of metrics. If you needs are sophisticated I would suggest you purchase such a product. If you need something very simple then your general approach seems good (though using a database seems better than a log file).
Joined: Oct 08, 2002
hiThanks for your responses. i think my question did not make the actual purpose clear. what i want done is to know how much time i spent serving the different pages to the customers and to track each user session. This is so I know what a particular customer tried to do or when he was actually made to wait a long time. Currently what I have done is this: Extended ActionServlet. In this when the request from the first page comes in I create a cookie using System.currrentTime. On each subsequent request that comes in I log the requested uri as well as the cookie value, the start and end time of the request and any other info I have of the customer. This way I know what requests were made by a particular customer and what time he had to waif after each request. Please let me know if there is a better way to do this. Thanks,