My requirements are that every time a user enters the page the mouse movements start to get recorded and once the user leaves the page, all the data (Coords x, y and time) gets sent to a server for later analysis.
If your mouse has a Macro Record button, you can record macros while you are running a program or playing a game. You can edit these macros later using the Macro Editor in the Microsoft Mouse and Keyboard Center. Note: You cannot capture mouse movement or actions performed through macros reassigned to a button/key.
Mouse actions can be recorded and played back using hotkeys, which are set to F9 and F11 for playback and record mode respectively. The same recorded action can be repeated several times regularly based on a time interval and an execution delay can also be set.
You can record events such as keystrokes, mouse clicks, and delays between actions. You cannot capture mouse movement or actions performed through macros assigned to reassignable keys.
unload()
Javascript:
document.onmousemove = function(e){
var pageCoords = "( " + e.pageX + ", " + e.pageY + " )";
console.log(pageCoords);
};
DEMO
Unload javascript:
window.onunload=function(){
//SomeJavaScriptCode
};
jQuery:
var pageCoords = []; //array for storing coordinates
$(document).onmousemove = function(e){
pageCoords.push("( " + e.pageX + ", " + e.pageY + " )");//get page coordinates and storing in array
}
$( window ).unload(function() {
//make ajax call to save coordinates array to database
});
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