Google's New Analytics Code

Recently, Google updated the javascript code used to track your pages for analysis. The former version was either the secure version or the non-secure version. Now, it's both - which is nice.

There are two bits to the code and here they are:

<script type="text/javascript">
  var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
  document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>

<script type="text/javascript">
  var pageTracker = _gat._getTracker("UA-XXXXXX-X");
  pageTracker._initData();
  pageTracker._trackPageview();
</script>

You must add your Google Analytics ID to the second block where indicated by the "UA-XXXXXX-X"

About this Entry

This page contains a single blog entry by Eric Anderson published on May 16, 2008 4:48 PM.

5 Advanced Tips for a ProStores Site Owner was the previous entry in this blog.

Lagier Ranches is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.