Tuesday, July 14, 2009

Adding Google Analytics to Blogger

Since I have integrated AdSense and FeedBurner with my Blogger.com blog, I figured it wouldn't hurt to integrate Google Analytics as well. Don't know what Google Analytics is? You must've been living under a rock for the past few years. It's a great web stats collection and analysis tool, and here's how I plugged it into my blog. First I needed to get tracking code for my blog from Analytics:
  1. Went to Google Analytics page and clicked on "Add new profile"
  2. Entered URL of my blog and clicked "Finish"
  3. Copied generated tracking code to clipboard (Ctrl+C)
With tracking code generated I had to find a good spot on the blog to paste it into. The best place seems to be the Blogger template, right before the closing </body> tag. To achieve that I:
  1. Went to Blogger Setting -> Layout -> Edit HTML
  2. Scrolled down to the very bottom and pasted (Ctrl+V) the code right before the </body> tag
  3. Clicked "Save template"
Now Analytics' tracking code will be loaded on every page of the blog, and none of the interesting stats will be lost. Did I mention that AdSense related information is automatically present in Google Analytics? Bonus! P.S. One downside of inserting tracking code directly into the template is the necessity to reinsert the code every time you pick a new template.