Data mining with AJAX
Just had an idea: how about using Javascript to record client-side usage of your website?
The principle is this:
- Register Javascript listeners which construct a list of events, particularly mouse, scroll and click events, along with the time that the event was fired.
- Register an
unloadevent which posts the information as XML with AJAX to a script on the server when the user leaves the page. - Browsing sessions can be collated on the server using cookies.
- Create a player, which reads the events as XML and renders them using a DHTML 'cursor' and/or by firing events within the DOM. Could have a time slider and fast-forward controls, etc, depending on how complex you want to get.
Voila - see exactly what people are doing with your site. I have knocked up a test which implements the first two steps, for mousemove events, and that much works, so the whole concept would be workable. I can imagine it would break down if your site uses plugins (or Javascript navigation, depending on how easy it is to replay the events accurately) but that's a limitation you would have to live with.
There are obviously privacy concerns but this is relatively mild as no personal data would be recorded. Perhaps it could pop up a Javascript window.confirm() dialog asking if it's OK to record your behaviour. But it would be a very useful tool for examining site usage, especially for commercial sites. This is the way modern marketing works. I leave it up to your conscience as to whether it's ethical.
October 27th, 2006 at 9:18 pm
wasn't that what google analytics is doing?
October 28th, 2006 at 12:50 am
I don't think so. I have a Google Analytics account but I never used it because having signed up for it, it appeared to just be a web stats package, except client-side rather than server-side (so less reliable).
I don't think it provides a real time view of individual visitors' behaviour on the site.