Question

I realized Yelp.com does some kind of tracking when the mouse move or something happens (click in element). How does it to this? Is there a library? How to do this without nearly zero performance impact?

You can see Console in Firebug below:

enter image description here

Was it helpful?

Solution

A very basic implementation of the mouse tracking could look like this: http://jsfiddle.net/pksah/

HTML:

<body>
    <div id="container"></div>
</body>

JS:

currentPosition = null;
$("#container").on("mousemove", function (event) {
    currentPosition = event;
});


setInterval(function () {
    console.log(currentPosition.pageX + "," + currentPosition.pageY);
}, 1000)

CSS:

#container {
    width:100%;
    height:300px;
    background:yellow;
}

OTHER TIPS

As I said in my comments looks like some advertisements/campaign tracking and it's related to some Google API tools you'll see similarities thrown in the console with this script:

http://closure-library.googlecode.com/svn/!svn/bc/4/trunk/closure/goog/docs/closure_goog_debug_errorhandler.js.source.html

Something with Google ad-sense, closure

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top