Monday, May 7, 2007

New Blogger Layouts and Google Analytics

Need some help in Installing Google Analytics in Blogger? or did you stumble here looking for New Blogger Layouts? Try our Template & Layout Finder.


Some people have reported that the new drag and drop layout of blogger does not work with google analytics. When testing the problem myself. I found out that the code which is typically in the format of

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
<script type="text/javascript">
_uacct = "UA-XXXXXX-X";
urchinTracker();
</script>


is changed to

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
<script type="text/javascript">
_uacct = &quot;UA-XXXXXX-X&quot;;
urchinTracker();
</script>


upon saving and probably that breaks the code. Actually this is an installation problem. you can't copy paste the code into the blogger layout code( because its XHTML code now). Google Analytics site recommends that you paste the tracking code before the </body> tag. That install procedure is outdated.

Below are the instructions for installing Google Analytics tracking code to new drag and drop layout of blogger/blogspot without problems.


  1. Login to your dashboard and click "Manage : Layout"
  2. On the template tab, select Page Elements
  3. On Page Elements, click Add a page element( I recommend adding it to the bottom of the page)
  4. On the pop up window click the "Add to Blog" option beside "HTML/JavaScript" Option
  5. On "configure HTML/JavaScript" popup window, paste the Google Analytics code in the "content textarea"
  6. Leave the title "blank" and Save Changes
Now, Google Analytics should be working on your blog. Leave your comments if Something still does not work.

Note : Google Analytics is working on a new version ( Which will probably be XHTML compliant). See more on this http://analytics.blogspot.com/2007/05/new-version-of-google-analytics.html .

Update: Some of the visitors have pointed out that the above method does not work correctly now,So, unless we find a workaround to make Analytics work with the new blogger, both would remain incompatible.