What I need is something which:
I would like to find something which have at least 3 of above implemented properly. I can also look at js frameworks like Dojo or JQuery if they can help me, but then will I be able to to keep it small enough?
How about writing it yourself ? :) Let's consider this simple jquery code :
put this in your < head >
<script src="http://code.jquery.com/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(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);
});
});
</script>
If you'll go to Firefox firebug, or IE/Chrome developer tools / javascript console you'll see all the values. You will need to implement simple event object with the data you need, and some mechanism to post the gathered data every couple of seconds (using jquery post or ajax method and JSON object )
Summarizing :
It's not bulletproof, you'll need the server part (simple php/asp.net mvc page to deserialize json and store it into db / xml whaterver you need ) and you're ready to go :)
as per the comment below about batching up the data - very good point. Changeing the .mousemove event to :
$('html').mousemove(function(event){
console.log("mouse move X:"+event.pageX+" Y:"+event.pageY);
var color = 'red';
var size = '2px';
$("body").append(
$('<div></div>')
.css('position', 'absolute')
.css('top', event.pageY + 'px')
.css('left', event.pageX + 'px')
.css('width', size)
.css('height', size)
.css('background-color', color)
);
});
will make it easier to imagine how much data it will be - each dot would be a single POST to the remote server
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With