Is there an existing js lib for capturing user activity browser side?
ie. Scrolling, mouse moving, mouse clicking etc. I\'ve been googling, searching stackoverflow and g
Maybe Something Like This: DEMO
Relevant Code(JS and HTML):
XXX
XXX
XXX
XXX
XXX
XXX
XXX
XXX
XXX
XXX
XXX
XXX
XXX
XXX
For the next part, That is to send it to server periodically you can use AJAX
with setTimeout
by first of all saving data in variable(instead of padding and logging it). and clearing it(variable) on every successful ajax operation (ie on readyState==200
). You can also send ajax request onbeforeunload.
Here is what that code actually does in a nutshell:
It attaches
the events
from the array of evnts
(you can also add events in that array) all to the window
element(which is quite faster than attaching it to all elements) and then it get events details if it's propogation
isn't stopped
, For details on how it get event description read comments from code.
Hope it helps :)!