Saturday, January 1, 2000

Adding Google Analytics to your Blogger blog

(As always, click on an image to see the full-sized version)

Google's free Analytics service gives you a multitude of information about your Web site's visitors. While it is aimed squarely at e-commerce sites, there is still a lot of good information in there for bloggers. There are two ways to add the Analytics code to your blog: add an HTML/JavaScript gadget to your blog's footer or add the code directly to your blog's template. The first is preferable if you think you may change templates at some point in the future -- gadgets remain while template customization are lost -- but some templates put visual breaks between gadgets which look odd when there is no visible content in the gadget.

So, if you're using a template (such as the class blog's template) that allows content-free gadgets to remain invisible, use option 1. If your template puts some visible divider between gadgets, use option 2. When in doubt, use option 2.

Adding Google Analytics to your Blogger blog:

  1. Go to the Analytics site, click the "Access Analytics" button and, if needed, log in using your Google account information.
  2. Click on "Add Website Profile"
  3. Select "Add a Profile for a new domain," enter the URL for your blog, double-check the timezone settings and click the Finish button.
  4. This brings up a page with lots of information. Down towards the bottom is a bunch of code you will need to copy/paste into your blog to enable Analytics to track your visitors. Select and copy all this code and click finish at the bottom of the page.
  5. Header over to Blogger and, from your Dashboard, click Layout for the blog you want to add Analytics code to.

Analytics can be added as a gadget (see above) or as as part of your blog template:

  1. Click on the "Edit HTML" link.
  2. Whenever editing your template's code, always download the current copy to you computer before making changes: click the "Download Full Template" link (screenshot). If anything goes seriously wrong, you can always undo your changes by uploading this file. (screenshot).
  3. In the Edit Template section, scroll to the bottom of the text area and locate the </body> tag. Paste the code you copied above just before the </body> tag. The final result should look like this:
  4. Click Preview just to make sure nothing got seriously messed up, then "Save Template" to finalize the changes.

Now for the hard part: waiting. It can take up to 24 hours to start seeing any results – the Google mothership only updates the reports once a day. So grab 40 winks and check back the next day.

However, you can check that the code you just installed is working by returning to the Analytics settings page, click Edit for the Web site in question, then "Check Status" and check the text in the Tracking Status section at the top of the page. You may need to wait a minute of two before Google finds the settings you just updated.

If you get any errors, please post a comment here along with the error messages you are getting.

0 comments: