Posts Tagged ‘Asynchronous tracking’
Kindly ignore yesterday’s post about asynchronous tracking code. After further research it was determined that we didn’t entirely know the full details of how this works with other services like Google Analytics. The code we released was simply waiting for onload to fire and then creating the script element that would trigger tracking. While this sort of achieves the same effect (it doesn’t interfere with your site’s loading), it definitely decreases accuracy, which is why we warned about that.
Well, forget all that, k? We just released an updated version that is truly asynchronous, and it should be more accurate, not less. Why? What we didn’t know yesterday was that if you inject a script element into the DOM, all modern browsers by default will download that script asynchronously, which means in parallel with anything else that is already downloading to a visitor’s browser. I’m embarrassed I didn’t know about this trick, but it’s true.
Taking this a step further, we modified the actual tracking code that you link to from your site so that the beacon it sends back to log data is also based on an injected script element, which means it now is asynchronous as well. Previously, we were using an image, which does not get this benefit.
We’ve been testing this new stuff most of the day for the tracking of getclicky.com, and it’s working very nicely.
So, if you do absolutely nothing, you will still automatically get the benefit of the asynchronous logging of data. You may still see waiting for in.getclicky.com… in your browser’s status bar, but it is not interfering with the downloading of other items from your web site.
But, if you want full asynchronicity, then go grab a fresh copy of the code from your tracking code page. This new code that you paste onto your site will also inject the tracking code script into your site’s HTML, which will give you the full benefit of this functionality.
On yesterday’s post, someone asked why we still recommended pasting it into the bottom of your site, rather than the head like Google Analytics suggests. The way the code from yesterday was designed, there was no benefit to placing it higher. But today, things are different. However, from what we have read, Google’s recommendation is incorrect. They recommend you place the async code inside your site’s head tag, but this code then manipulates the head object directly before the browser has fully parsed it. Everything I have read says you should not do that, as it can cause serious browser malfunction. If you want to place this code higher up, we recommend doing so at the very top of your body element, rather than the bottom. But we really don’t think it will make much of a difference either way.
Ok, go enjoy!
Update: Kindly ignore this post. Please read this one instead.
By popular demand, we are releasing asynchronous tracking code. This means tracking your site with Clicky will have literally zero impact on the loading speed of your site, because the code won’t be downloaded and executed by the end user until your page has fully loaded. Although our tracking code is on a CDN and should load very quickly already, there has been demand for this, so we are offering it.
Grab a copy of it in your site preferences area.
We are not making this the default tracking code because there are a few gotchas:
- Stats will probably be slightly less accurate (this problem affects every analytics service that offers async support – but we want to be up front about it)
- clicky.log() events that your page fires in the first 500-1000ms probably won’t be logged
These are explained in further detail on the tracking code page, so please read the whole thing before deploying this code!