Free tech support / small logo


How can I add Google Analytics to my web site?

I keep hearing from you and others that I really need to be tracking how people use my Web site and that I should be collecting "aggregate traffic statistics" and such. I've heard that Google Analytics is good - and the price, free, is great - but I'm not really clear how to use it and add it to my site. Can you please step me through the process, Dave? Thanks!


Dave's Answer:

You have received good advice! Regardless of the level of complexity of your Web site, whether it's a huge blog with thousands of articles - as mine is - or a five page brochureware billboard for your service business, it's critically important and darn useful to be able to know how many people are visiting your site, from where, how, and what they do once they're on the site.

As a simple example, let's say that you offer three different services through your company and you have three pages on your little Web site that highlights those, one per page. Which gets more traffic? What can you conclude about the appeal of your business based on that? Which of those converts into the potential customer picking up the phone and calling you or clicking on "contact us" and emailing in a query? Without feedback you're in the dark. With feedback you can continually refine your pages and your business both, growing smart and effective.

Google Analytics is a bit tricky to set up too, so I'm not surprised you've a bit of trepidation about doing so. It involves copying and pasting some pretty complicated code. The good news, though, is that you don't need to understand the HTML and JavaScript you cut and paste, you just need to not mess it up!

Start by going to Google Analytics and either signing up for a new account or signing in to your Google account. The button you seek is this:

google analytics

Once you've signed up you'll see an overview page which won't be very exciting since you don't have any collected data as of yet. On the right you'll see this, however:

google analytics overview detail

Click on the "+ Add new profile" link and you'll be able to specify the URL of your site:

google analytics create website profile

Here you can see that I'm actually stepping through the process of adding the analytics code to my film blog, Dave On Film.

Confusingly, the system then gives you an error message that there's no data to show:

google analytics tracking code status

Well, duh, there's no data because we just set up this account. You'd think Google would be a bit smarter about this step of the process!

Scroll down a bit on this page and you'll see the following:

google analytics tracking code

All you need to do now is basically copy and paste the complicated-looking HTML code that's in the box. Click anywhere in the box, which should select all of the content. Now type Ctrl-C, or Cmd-C or choose File --> Copy (depending on PC or Mac).

Open up another browser window or a new tab and get to the source code for your own Web pages. If you have a blog, you're in luck: just open up the appropriate template or templates so you can access the skeletal contents of the site.

Move to the bottom of the source page and before any sort of </body> or </html> simply paste the block of code from Google Analytics.

Save the new pages, rebuild your blog if appropriate. If you have a site where you're managing the pages manually, then you want to paste the analytics code onto every single page you'd like it to track and analyze for you. If you skip some, it won't know about them and your reporting data could be skewed.

Now that you're done adding the code, refresh the page on Google Analytics and instead of getting the earlier error, you should see this:

google analytics tracking code verified

Great. Now it's just a matter of sitting back and relaxing, waiting for some traffic to show up so you'll have analytic data. In the meantime, this is what it'll look like:

google analytics no visits

Remember that unlike many other services, Google Analytics is not real time, so if you reload a page, don't expect to instantly see that traffic reflected in your reports. Generally I find that analytics is about 12 hours behind.

Now your challenge is to drive traffic to your site and to remember to at least occasionally go and look at the Google Analytics data!









Subscribe!
Never miss another Q&A article! Click to subscribe: Add to Google Reader Add to My Yahoo! Subscribe in NewsGator RDF XML
Comments

I'm glad this came up because I have a couple of follow-up questions (I already have Analytics on my company's 1-year "new" website):
1. How often should one look at Google Analytics reports?
2. I know how to READ the reports; i.e. I can regurgitate the information in them to my supervisors, but what do I DO after that? i.e. How does one really sort through and INTERPRET the really IMPORTANT stuff because it seems to me - and I'm pretty web-savvy - that GA almost contains TOO much info.
Thanks!

Posted by: stlfarr at June 1, 2009 11:53 AM

Thanks for the tip, Dave. That made it easy. I'll try it out.

Posted by: Eric Savage at June 11, 2009 9:59 PM

You can actually change the date range in the URL so that the current day's data is included in some (maybe all) of the analytics reports.

Sitemeter is good for instant gratification.

Posted by: Kosmo @ The Casual Observer at June 17, 2009 3:10 PM

Thank you. I'm going to try this.

Posted by: Val Reimer at October 23, 2009 10:37 PM

Thanks, Dave. You saved me once again!

Posted by: Jeannine C at April 22, 2010 10:14 AM

Hi Dave,

Just a quick one do google provide support for google analytics, in case they do ( are they charging for the same)???

Posted by: pamsy at May 13, 2010 12:54 AM

Excellent information. But Now days Google Analytical advise add Code in between Head Section.

Posted by: Vincent at June 16, 2010 4:26 AM

oh! Many thanks to you !!!!

This a very good information to all. I am adding Google Analytics tool to day.

Thankyou.

Posted by: Vidaso Valee at July 22, 2010 1:29 PM

Hi Dave,

A wonderfull, very simple explanation about tracking email/HTML campaign. I was struggling to understand how it works. Now am very much clear.

I have few questions and i would appreciate if you answer these for me

1) In the article it is mentioned google analytics code to be copied and pasted in the template(s)(service providing). How do I generate the new url for each services as I will be using the same template for displaying different services?

2) Is the procedure for google analytics tracking on social media campaigns (facebook, twitter etc) same as email campaign? Like generate code in GA, copy and paste in the templates etc.

3) Is there any way where I can track my SMS campaign also?

4) As I am planning implement all the three in my application, do I need to create three different GA accounts?

If you could give me your mail id, I would like to discuss more on this. If you dont mind.

Thanks in Advance
Aradhya

Posted by: Aradhya at August 4, 2010 3:01 AM

first of all very good tutorial and secondly i want to show this information on my own webiste how can i do this. i dont want to go google analytics account. is there any way to do this?

Posted by: shani at January 7, 2011 8:43 AM

hi, i am desperately trying to add google analytics to this iweb site. I am really struggling, I have an Analytics profile and can copy the code it gives me but don't know how to successfully attach it to my site. i have tried snippets with iweb and the iweb seo tool. is this just not possible or advisable?
would really appreciate your help.
Regard,

Helen.

Posted by: Helen at February 28, 2011 11:50 AM

It Allows usage of custom variables in Google Analytics to track meta data on pages. Thanks for your support will try soon.

Posted by: Avenir at April 28, 2011 4:56 AM

I have something to say, now that you mention it, but ...
Starbucks coffee cup I do have a lot to say, and questions of my own for that matter, but first I'd like to say thank you for all your efforts on this Web site by buying you a cup of coffee!

I do have a comment, now that you mention it!











Remember personal info?


Please note that I will never send you any unsolicited email. Ever.

While I'm at it, please note that by submitting a question or comment you're agreeing to my terms of service, which are: you relinquish any subsequent rights of ownership to your material by submitting it on this site.









Recent Entries


Search
I Need Help!
Need Help? Ask Dave Taylor!


© 2002 - 2012 by Dave Taylor. All Rights Reserved.

Note: This web site is for the purpose of disseminating information for educational purposes, free of charge, for the benefit of all visitors. We take great care to provide quality information. However, we do not guarantee, and accept no legal liability whatsoever arising from or connected to, the accuracy, reliability, currency or completeness of any material contained on this web site or on any linked site.

[whiteboard marker tray]
"Ask Dave Taylor®" is a registered trademark of Intuitive Systems, LLC.