html - Javascript capturing user activity -
is there existing js lib capturing user activity browser side?
ie. scrolling, mouse moving, mouse clicking etc. i've been googling, searching stackoverflow , github keep getting links paid analytic programs aren't quite i'm after.
i'm tempted start building myself, more think it, harder realise it'll , i'd better off using existing lib if available.
what i'm thinking. appropriate way go it?
- i'm assuming best way listen on body or window element , capture desired events haven't had bubbling disabled.
- it'd nice batch , minify data before emitting/posting server. in remove mode or occurring data. if user scrolls don't need scroll events, meaningful ones start, accelerate or stop.
- could emit batches every x number of events or x seconds. , send final batch
window.onbeforeunload
.
i found these 2 questions here & here. aren't quite i'm after.
i want able configure event aggregation ask question on user interaction. admittedly i'm out of date google analytic, , maybe i'm wrong, @ glance custom event tracking doesn't seem fit bill. logging specific individual actions isn't i'm after.
you must write ( or @ least that's did ).
backup question : is there javascript library capture mouse/keyboards events , send them external server?
here working jsfiddle: http://jsfiddle.net/94dd343y/
$(document).ready(function(){ $('html').mousemove(function(event){ console.log("mouse move x:"+event.pagex+" y:"+event.pagey); }); $('html').click(function(event){ console.log("mouse click x:"+event.pagex+" y:"+event.pagey); }); $('html').keyup(function(event){ console.log("keyboard event: key pressed "+event.keycode); }); });
and on.
if want capture events, here list:
- abort
- afterprint
- beforeprint etc. is possible programmatically catch events on page in browser?
Comments
Post a Comment