Skip to content

Instantly share code, notes, and snippets.

@wezoalves
Created January 11, 2013 20:32
Show Gist options
  • Save wezoalves/4513747 to your computer and use it in GitHub Desktop.
Save wezoalves/4513747 to your computer and use it in GitHub Desktop.
save positions clicks into page
var collectionsClicks = new Array();
var observerClicks = function(event) {
var info = new Object();
info.position = {};
info.position.click_x = event.x;
info.position.click_y = event.y;
info.position.screenX = event.screenX;
info.position.screenY = event.screenY;
info.screen = {};
info.screen.innerWidth = window.innerWidth;
info.screen.innerHeight = window.innerHeight;
info.screen.width = screen.width;
info.screen.height = screen.height;
info.element = {};
info.element.className = event.srcElement.className;
info.element.url = event.srcElement.baseURI;
info.time = {};
info.time.timestamp = event.timeStamp;
collectionsClicks.push(info);
}
document.onclick=observerClicks;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment