WordPress 101 Guide : Enhance the speed of your site with asynchronous google analytics

Wordpress 101 Guide

If you use google analytics to track your sites, google has a released a new tracking code that will take advantage of browser support for asynchronous JavaScript to enhance the speed  in which is loaded.

With the new code, simply insert the code at the bottom of the </head>  section.

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-XXXXX-X']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);


Replace _setAccount method with your web property ID.

My recommend and simplest way of solving this solution, is to install the  Platinum SEO wordpress plugin and once installed visit the plugin admin panel and insert the code in the fields :  additional post headers, additional page header and additional home headers.

Enhanced by Zemanta

Leave a Comment