22 March 2012

Using Google Analytics with Blogger Tutorial Part 1

Sum-up
Subtitle
Facebook
Tracking
Wall-Off
Technology Tuesday
Michael Moral

Tracking visits and activity on your blog is very important. The better the tool the better you can make your blog and when it comes to Tracking web-user statistics "Google Analytics" is the best tool out there, which is why I would recommend every blogger to start using it instead of(or in conjunction with) the Blogger Stats feature.

This tutorial aims to help you through setting up "Google Analytics" for your Blogger blog.

Open a Google Analytics Account and Use it with Blogger
Assuming you already have a Google account for GMail or Google+ visit: http://www.google.com/analytics. You will come across this screen:
Sign Up for Google Analytics

Whether you choose "Access Analytics" or "Sign Up Now", you will end up at the same place, which is shows in the screen shot below:



In the above page will click the "Sign Up" button. You will come across the page below. In this page you need to enter the following information:

  • A name/label for your Google Analytics account. This can be anything you want. I have chosen to call mine "Jenson Taylor Analytics"
  • The website address(URL) of your blog. Mine is "JensonTaylor.blogspot.co.uk"
  • You can choose how you want to share your data. This doesn't make a difference at this point. I have chosen the options which will integrate my Google Analytics account better with other Google services such as Ad Words. I would recommend that you choose the same options as I have in the screen below. (If you would like more explanation on these options please leave a comment and I will get back to you)
  • Choose the country you live in
  • After reading the terms and conditions, assuming that you agree with all of them. Tick the check box which says "Yes, I agree to the above terms and conditions."
Google Analytics First Create New Account Page


Click on "Create Account".

You will then see the page below which contains a unique identified called the "Tracking ID" and looks like UA-22222222-1. Make a note of this identifier (you will need to enter this identifier in your Blogger settings).

Generating Tracking code in Google Analytics
In the screen shot above you will see that I have highlighted the options for the section under "What are you tracking?". You can choose either one of those options that I have highlighted using the red arrows. The first option is what I would have recommended previously. However Blogger has started to roll out some changes recently that would affect this. Your blog address is going to change based on the country you are in, so previously the address of my blog was jensontaylor.blogspot.com however it has now changed to jensontaylor.blogspot.co.uk; It is because of this change that I would now recommend you to choose the last option on the screen above.

Now click "Save" and you're done with Google Analytics.

Note: Ignore the number 2 option in the screenshot above. (You do NOT need to copy/paste code anywhere)

Go to you blogger dashboard then browse to "Settings" > "Other" and enter the "Tracking ID"  for your blog in the field which is labelled "Analytics Web Property ID" (You can see the Tracking ID in your Google Analytics - see screen shot above for details)
Blogger Web Property Tracking ID for Google Analytics
Click "Save" and you're done.

Older Templates (To be ignored for most bloggers)
Most bloggers do not need to worry about this issue but if you are using a really old template then adding your blog's Analytics Tracking ID here might not work correctly. So you will need to go back to Google Analytics and copy the code given to you in Google Analytics into your template. For this go to your blogger's dashboard then browse to "Template" > "Edit HTML" > "Proceed"
You should now see all the code, search for "</head>" without the quotes. Once you find it, insert the code just before it. So before changes your code will be:
  </head>
After adding your Google Analytics code, it will look like this:
<script type='text/javascript'>
  var _gaq = _gaq || [];
  _gaq.push([&#39;_setAccount&#39;, &#39;UA-222222-1&#39;]);
  _gaq.push([&#39;_setDomainName&#39;, &#39;blogspot.co.uk&#39;]);
  _gaq.push([&#39;_setAllowLinker&#39;, true]);
  _gaq.push([&#39;_trackPageview&#39;]);
  (function() {
    var ga = document.createElement(&#39;script&#39;); ga.type = &#39;text/javascript&#39;; ga.async = true;
    ga.src = (&#39;https:&#39; == document.location.protocol ? &#39;https://ssl&#39; : &#39;http://www&#39;) + &#39;.google-analytics.com/ga.js&#39;;
    var s = document.getElementsByTagName(&#39;script&#39;)[0]; s.parentNode.insertBefore(ga, s);
  })();
</script>
  </head>
Click "Save Template" and you're done.


Why use Google Analytics with Blogger?
You might ask yourself why should I use Google Analytics with Blogger when the Blogger stats already provides all the details I need but the more people follow your blogs the more important it becomes to adapt your blog to your readers advantage. Google Analytics not only gives you details about how many people visit your blog but also where they come from e.g. search engines, feed, email, Facebook, etc. 
If that wasn't enough Google Analytics also lets you know whether your blog followers read your blog from the mobile phone or on a computer, it lets you know what operating system and browser they use.
My favorite feature is information about the screen size. By looking at the screen sizes that followers of my blog use, I make sure I change the width of my page to suit the majority of people that have a certain screen size which will enhance their experience.

Here is follow up blog for more adventurous users who like to experiment with a customized dashboard on Google Analytics.

If you'd like to be updated on new blog posts please subscribe to RSS feed and/or via email.

22 comments:

  1. Thanks for this. I've had some issues getting Analytics to track my traffic using Blogger's settings, so I put the code is in my template instead. Maybe it's time to give it another go the easy way...

    ReplyDelete
    Replies
    1. I had problems as well which is why I documented everything while I re-did it yesterday. For those people who use the new templates it's very easy and straight forward.

      Just a pointer: If you use old Google Analytics code, the recommended insert point is just before the end of the "body" tag however if you use the new Google Analytics code which you should be doing, insert it just before the end of the "head" tag.

      The reasoning for this change is that previously the javascript code would be retrieved from Google servers instantly which could slow down the loading of a webpage which is why they recommended that you put it as the last thing in your page just before the end of the "body" tag. However convention has it that all javascript file should ideally be located in the "head" section of web pages hence they changed the code to retrieve the Google Analytics javascript code asynchronously instead which means it will be loaded into your page after the page itself has finished loading. Hence providing your readers with a better experience and faster loading time.

      Delete
  2. Do you know i know your Analytics Code :P

    ReplyDelete
    Replies
    1. Yes of course. That's not a problem. The point is to avoid anyone mistakingly use my analytics ID in their blog while they follow the tutorial. It's not a secret... lol

      Delete
  3. I'm using analytics too. :)

    ReplyDelete
  4. I tried setting this up, but for some reason, the analytics site tells me that I don't have the tracking code installed. I tried it both ways, the automatic, and the manual html editing. I deleted the html tag when it didn't work and then tried the automatic way. Even re did with a different property id.

    Does it take a while for it to kick in? Or am I doing something wrong?

    ReplyDelete
    Replies
    1. It takes a while for it to kick in. Also, after you install it you need to wait at least 24 hours before data is shown on your Google Analytics page.

      The safest option would be to use one of the new templates for your blog. Since they accommodate for Google Analytics quite easily.

      Delete
  5. Hi, I'm sorry - I just read this article. I installed google analytics on my blog the other day and I do have tracking, but I was wondering why there is a difference between my blogger dashboard stats and google analytics. GA isn't giving me all the information I need. Is it because it only tracks my website and not an individual post?

    Just curious! Thanks for your help!

    ReplyDelete
    Replies
    1. If you have installed GA correctly then all your posts will be tracked.

      There will be a difference between the stats on Blogger Stats and GA though, for more details see http://jensontaylor.blogspot.com/2012/03/blogger-stats-vs-google-analytics.html

      Delete
  6. Thank you for a great tutorial i follow your step properly and finally put the google analytic correctly in my blogger. Thanks

    ReplyDelete
  7. Hi Jenson,
    Do you know why the countries shown in my stats are also significantly different? For example, in my GA it shows UK, but in my blogger it shows Russia and no UK. Weird huh?

    ReplyDelete
    Replies
    1. This is only a guess but it might be the case the two products use different IP to location mapping software and one of them must be wrong.

      Delete
  8. Hi Jenson,
    great information, thanks. One question, I use a custom template I uploaded via the import/backup feature. I didn't develop the template myself so I'm not totally sure on the details of the code. Should the tracking id in the Settings/Other work fine? Is there something I can check you would you recommend I add it via "Edit HTML"?

    ReplyDelete
    Replies
    1. It depends on your template. I would recommend that you add the id in the settings and wait 48 hours, if you see stats in Google Analytics then you know it works correctly.

      Delete
  9. Hi I have the same issue as Anthony, I'm also using a custom theme. I have added my code to the GA code box in blogger. But I'm getting no reports and my tracker says it is not installed. I have opened edit HTML on blogger and cannot see the snippet or any HTML or body tags. What do I do? Should I download the blog and edit it manually? I'm doing all this on an iPad and it will not let me copy and paste the code from GA so I cannot edit it until I get to a PC.

    I'm unsure if it matters but when I first set this blog up I unknowingly had a proxy server installed on my iPad profile, this caused blogger to spaz out and created me multiple blogs with .uk and .ie, I had set up GA at this point.
    Now I have moved my blog to a new blog and started again, then I had directed it to my domain name. GA is set up now with my manually Editted URL but still I get no stats and the tracker is not installed? I'm so confused can you shed any light on this please? Many thanks

    ReplyDelete
    Replies
    1. the best option is to go on a PC and try the above procedure. If it still fails then you will need to edit your theme which requires some knowledge of HTML.

      Delete
  10. Thanks so much, this was really useful. I was afraid I'd have to cut and past text into html, but this is so simple!

    ReplyDelete
  11. Great Post! Lots of helpful info.

    ReplyDelete
  12. Thanks for your post, it was helpful

    ReplyDelete
  13. Did you say that "Your blog address is going to change based on the country you are in, so previously the address of my blog was jensontaylor.blogspot.com however it has now changed to jensontaylor.blogspot.co.uk"?.
    I thing that is not a right info. Your blog's canonical (primary domain extention) is still a ".com" -> jensontaylor.blogspot.com
    for visitors from india, it will be jensontaylor.blogspot.in
    And,if you use an anonymous proxy,then it'll be jensontaylor.blogspot.com
    so ,you cant simply say that "previously the address of my blog was jensontaylor.blogspot.com however it has now changed to jensontaylor.blogspot.co.uk".
    Hope you could understand it. :)

    ReplyDelete