December 20, 201015 yr Hi, I would like to ask if anyone have experience in monitoring user activity with php and javascript. We have adminisrators working, uploading data on php based forms, and we would like to monitor their activity. There are 2 buttons: start work and finish work. When they click start work, the time is saved in a datatabase and when they click finish work, time is also saved in a database. This way we can calculate how many hours they were working, but we would like to know more about their activity. So far I am using this plugin: http://paulirish.com/2009/jquery-idletimer-plugin/ It would be ok, but I would like to send an ajax request to finish work, when they close the window. I have difficulty with that!! Does anyone know how could I check if an administrator is still working on our site? Is there a way to do it with php? I know it is server based, but I am thinking of sending a request to the client and if they answer that would mean that they are still working, if there is no answer for a coulpe of minutes then we would stop the work by inserting the time in the database? Is there a way to that? Also, the administrators have to visit other websites to fill in our forms, to get more info. I would like to stop the timer when they visit other sites. Blur and focus events do not seem to wrok!!! Is there another way of checking it. Does anyone have another method/idea of how should I do this? Tanks for everyone who is reading it and trying to help me!
December 20, 201015 yr I don't know how reliable/accurate any kind of web based activity tracking system is going to be. $(window).unload( function () { $.ajax({ type: 'POST', url: '/tracker.php', data: {idle: $.idleTimer('getElapsedTime')} }); }); //dont know if this would work as well... $(document).ready(function() { $(document).blur(function() { //lost focus, stop timer? }); });
December 22, 201015 yr Author I don't know how reliable/accurate any kind of web based activity tracking system is going to be. $(window).unload( function () { $.ajax({ type: 'POST', url: '/tracker.php', data: {idle: $.idleTimer('getElapsedTime')} }); }); //dont know if this would work as well... $(document).ready(function() { $(document).blur(function() { //lost focus, stop timer? }); }); Thanks for your reply! I have tried blur and focus events, but they do not work. I also had difficulty with stopping the timer. When I use "$.idleTimer('destroy');", it destroys the timer, and it will not start again, so I tried to change the time for a longer period for blur and change it back on focus, but it does not work. IE senses unload also on load. I also notice some delay with the ajax calls, when I move the mouse again, the ajax call does not come straight away. Or is it just firebug? I agree with you, I do not think that it will be reliable!
Create an account or sign in to comment