HTML5 + JS: tracking user interaction

Which would be a good way to track user interactions on a website. And then I mean capturing everything, like:

  • scrolling
  • Button press
  • Move cursor
  • Outgoing input

Of course, with a lot of HTTP post / get requests, it can be unpleasant for the user. I am looking for a way to do this without annoying the user and without losing data.

I hope someone has experience!

+4
source share
1 answer

. , , , , , , .

, . . (Fiddle: http://jsfiddle.net/8ucSV/):

var Spy = (function (register, undefined) {
    var eventStore = [],
        // you can also add other things like "mousemove" here…
        events = ['click'];

    var store = function (type, data) {
        eventStore.push({
            type: type,
            data: data
        });
    };

    events.forEach(function (event) {
        register(event, function (data) {
            store(event, data);
        }, false);
    });

    return {
        dump: function () {
            console.log(eventStore);
        },

        store: function () {
            // do whatever you wanna do here…
        }
    };
})(document.addEventListener);

, , , addEventListener. .

+3
source

All Articles