Make Drupal load faster with Google analytics asynchronous tracking code
Mon, 26 Apr, 2010
New Google analytics code loads asynchronously allowing your page to load faster. It is easy to migrate from old code snippet to asynchronous tracking code.
Asynchronous tracking is an improved way to track website visitors with Google Analytics. Unlike a traditional installation, asynchronous tracking optimizes how browsers load ga.js so its impact on user experience is minimized. It also allows you to put your Analytics snippet higher in the page without delaying subsequent content from rendering.
The new tracking snippet offers the following benefits:
- Faster tracking code load times for your web pages due to improved browser execution
- Enhanced data collection and accuracy
You can move to new code by remove old code to new by the following template (from Google)
- Replace UA-XXXXX-X with your web property ID
- Insert the asynchronous snippet at the bottom of the <head> section of your pages, after any other scripts your page or template might use.
I don't know why "Average Time on Site" at my website reduces after using new tracking code!