все это в хидер сунь и будет тебе счастье
<script type="text/javascript">
var mouseX = 0;
var mouseY = 0;
var coordsX = [];
var coordsY = [];
var postDATA = {'coords' : []};
function getMouse(e){
mouseX = e.pageX;
mouseY = e.pageY;
if (mouseX < 0){mouseX = 0}
if (mouseY < 0){mouseY = 0}
// 1 способ
/*coordsX.push(mouseX);
coordsY.push(mouseY);
postDATA = {x: coordsX, y: coordsY};*/
// 2 способ
postDATA.coords.push( mouseX + ',' + mouseY )
return true;
}
function clearAR(){
coordsX = [];
coordsY = [];
postDATA.coords = [];
}
$(document).ready(function(){
$(document).mousemove(getMouse); //label1
var timer = setInterval(function(){
$.post('server.php',postDATA);
clearAR();
$(document).mousemove(getMouse);
},4000);
});
</script>