Wednesday, February 2, 2011

How to install Google Analytics on Blogger

There seems to often be confusion as to how to install Google Analytics to Blogger (blogspot) blogs

Last I looked there were instructions for installing the Traditional version of the tracking code into a widget, or for installing the Traditional version of the GA tracking code before the closing </body> tag, however none seemed to really address in detail how to install the current Asynchronous version of code in a simple to understand way for new users.

Whilst the Async version of Google Analytics tracking code can be installed before the closing </body> tag, often other script within the blog layout can interfere with it working correctly. The same applies to placing the Async tracking code into blogger widgets.

So, lets get started ...


Log into your blogger dashboard. Yours may look a little different to mine. I use blogger in draft mode. Click on the Design button for your blog.

Where to find your blog's Design tab in blogger dashboard


Click the Edit HTML tab and then click once in the template code box.

Select Edit HTML tab and click once in the code box


In the upper menu bar of your browser window click "Edit" and then "Find on this page" (IE) or "Find" (FF) and then in the search box that becomes available type </head>

Use your browser find feature to locate the closing head tag

Insert the tracking code before the closing </head> tag and save the template changes

Insert the google analytics tracking code and save changes

You should start to see visitor data within 24hrs (if not sooner)

Couple of things to keep in mind.
1) Google Analytics and Blogger Stats track and report visitor data differently. Don't expect Google Analytics to show the same visitor data/numbers as Blogger Stats.

2) Once you insert and save the tracking code into your blogger template, don't be alarmed in regards to blogger changing the appearance of the coding within the template if you decide to view the source code via your browser.

Blogger simply converts the tracking code to a code format that is compatible with blogger template code. Though the code looks different in the template html to what you pasted in, if you go to your blog address and right click somewhere on the background and select "View Source", once you have a look at the source code you will see that the analytics tracking code appears/reads as it should.

3) Analytics will log your visits to your blog unless you create a cookie to exclude your own visits. Find out how to exclude your visits here.

37 comments:

  1. great! clear and easy! thanks!

    ReplyDelete
  2. Thank you for the feedback, much appreciated!

    ReplyDelete
  3. Cheers, glad you found it useful :-)

    ReplyDelete
  4. OMG, thank you so much, it has taken me days to find out how to find (head tag) in the html code.

    ReplyDelete
  5. Thanks @ Anon.

    @Pamela - glad you found the info useful, it can be a bit daunting when confronted with a whole mess of code in a template!

    ReplyDelete
  6. Sadly, still no joy as I do not get offered the option to type in Find page so am unable to ask it to find 'head' on my blog after clicking on the template. Everything fine up to that point ... still at a loss. Why is it so complicated?

    ReplyDelete
  7. @ Anon

    what browser are you using?

    ReplyDelete
  8. Thank you! Hopefully it has worked now, I think I was putting it in the wrong place and it was messing with my tabs!

    ReplyDelete
  9. Nps, hopes its now all playing nicely for you :-)

    ReplyDelete
  10. thx for ur information..i will try it

    ReplyDelete
  11. thanks for the screenshots!

    ReplyDelete
  12. Thank you so much! I'm new to all of this and your tutorial was so easy!

    ReplyDelete
  13. thnk Whimsical, i've tried, got a bit confused w/ the copy and paste part, but let's hope for the best . . .

    ReplyDelete
  14. Hi Serena :-)

    Which blog have you installed the tracking code to? I'll take a quick peek via my browser and see if its setup right for you if you like.

    Regarding followers widget. I sometimes have probs with Google Friend Connect too, if that is what you are referring to? Occasionally Google makes changes to code on their side in some aspect and it sends things pear shaped.

    If you are experiencing problems usually the best place to have a look and/or report it is on the blogger help forum.

    ReplyDelete
  15. Are you still happy to help with tracking code problem?

    ReplyDelete
  16. What are you having issues with? :-)

    ReplyDelete
  17. I have followed the instructions and they were very helpful. Although google analytics still says "tracking not installed". does that take awhile to change? otherwise, is there something wrong? thanks for this !

    ReplyDelete
  18. I used to use my GA just fine, now it's stopped working...it's saying I have no one visiting my site when I know I do. I haven't used GA for a while now... have I missed something? I'm using a wordpress pro blog... the link to my site is www.corinnahalloran.com
    thank you!!

    ReplyDelete
  19. @ Jerrad has your tracking now started to collect data?

    @cmhalloran I cannot access your site with my browser to have a look at the code, there is an error that keeps causing my browser to to crash. from the quick glimpse I get, it is in relation to the tracking code. You may want to uninstall and try using one of the free plugins for installing analytics available via wordpress.org

    Cheers
    Whims

    ReplyDelete
  20. Great post! Hopefully it has worked now. Thank you so much :)!

    ReplyDelete
  21. Can you update these instructions for google Chrome? also the new version of blogger. Thanks

    ReplyDelete
  22. @ Eric

    The new version of blogger enables you to now add the GA tracking code via the blog settings. You only need to insert the UA# into the provided field under Settings > Other > Analytics Web Property ID
    Then hit the orange Save button at the upper right of the blogger interface

    Cheers
    Whims

    ReplyDelete
  23. how did you add these FB, twitter and share buttons to your blog?
    I want to do the same in my blog at:
    http://dsvakola.blogspot.com
    Please reply...

    ReplyDelete
  24. Hi VSagar, its not really on topic with what this blog is about (google analytics) however you goto the layout mode and click on the small edit button at the lower right of the pane that says Blog Posts you should be able to enable the buttons... or you will have to install something like a 3rd party widget for a service such as AddThis.
    For further help with blogger questions the Blogger Help Forum
    http://www.google.com/support/forum/p/blogger?hl=en
    is a great resource for help

    ReplyDelete
  25. @Whimsical - do you think this also works if any changes made on your template? I mean i made a lot of changes in CSS and also the whole HTML code.

    ReplyDelete
  26. @Holistr.. does what also work if you have made template changes?

    ReplyDelete
  27. "this" refers to the the steps you described in this article to add tracking to my blog.

    ReplyDelete
  28. I've never had any problem with manually inserting the code into the template, providing its been inserted just before the closing head tag.

    Using the new blogger settings to insert the code seems to insert it at the bottom of the page.. which should still work fine too.. however other script on the page might prevent it from working .. and unless inserted before the closing head tag you wont be able to use it as site ownership verification for google webmaster tools.

    ReplyDelete
  29. Thanks very much - great help!

    ReplyDelete
  30. Hi Whimsical,

    I'm using new blogger interface and trying to paste the code, getting this error: "More than one widget was found with id: Navbar1. Widget IDs should be unique."

    Could you help!

    ReplyDelete
    Replies
    1. Hi Mikesworld, sorry for the delayed reply.

      I'm not sure why you would be getting that message unless you have somehow created the code for a widget to input it manually in your template or you are you have the option to expand the widgets template checked (which isnt necessary to paste in the tracking snippet)

      Delete
  31. I am having trouble installing Analytics onto my Blogger blog. I followed your directions exactly (very easy to follow btw...thanks) but in Analytics the tracking status still saying "Tracking Not Installed" It has been almost 48 hours and no luck. Hope you can help me!

    ReplyDelete
  32. Thanks for your reply, I was actually able to figure out how to install analytics, I initially thought with the new Blogger interface only Dynamic views could use the simple no HTML setup. I do have another question though and thought I'd see if you could help, I'm trying to setup the Analytics Social Media plug-in. I think I have the HTML I need, however there are no resources telling me exactly what to put and where to put it. If you could help I would greatly appreciate it.

    ReplyDelete
  33. Hi there Merrit, the best guide i can think to point you to is the following:

    http://www.lunametrics.com/blog/2012/03/29/tracking-social-google-analytics/

    ReplyDelete

Hi, thanks for submitting a comment.