title: Recording user data for heatmap with JavaScript
body: <p>I was wondering how sites such as crazyegg.com store user click data during a session. Obviously there is some underlying script which is storing each clicks data, but how is that data then populated into a database? It seems to me the simple solution would be to send data via AJAX but when you consider that it's almost impossible to get a cross browser page unload function setup, I'm wondering if there is perhaps some other more advanced way of getting metric data.</p>
  
  <p>I even saw a site which records each mouse movement and I am guessing they are definitely not sending that data to a database on each mouse move event.</p>
  
  <p>So, in a nutshell, what kind of technology would I need in order to monitor user activity on my site and then store this information in order to create metric data? I am not looking to recreate GA, I'm just very interested to know how this sort of thing is done.</p>
  
  <p>Thanks in advance</p>