The Web Development Blog has moved to Please visit me there to read the latest entries and to update your bookmarks and RSS feeds.

June 18, 2008

Tips for installing Google Analytics on Case and other Web servers.

Google Analytics traffice Sources
Traffic sources: a wee fraction of the data available

There comes a time in every Web maintainer's life when the boss or client asks to see the Web stats for the past 6 months/year/5 years or what have you. Ideally you or your server administrator set this up long ago; you—being equally keen to understand the usage patterns of your site, and to use that knowledge to improve your content—check them on a regular basis, and can provide the information immediately.

Then again, if you've been busy building and updating sites, this may be one of those projects that has been patiently waiting on your to-do list. If your server doesn't have analytics software pre-installed, and you've not yet installed any yourself, now—before the boss asks—is the time to do so.

This is particularly important for users who host sites on the main Case server.

Since upgrading the Web server, we have switched from using Aurora Stats to using Google Analytics on our sites. Where in the past you would have run a monthly report using the A.P.A.S. utilities, now you just install your tracking code once—after which you can view your data at any time. (We are also exploring additional server-based analytics software that we may install in the future to augment what is available through Google.)

Getting Started

To begin the process go to If you have an existing Google account you can login here to set up your analytics account. If you don't already have a Google account you can sign up to create one.

Creating your site profile
  1. Login to Google Analytics, then select "Analytics Settings"
  2. Click on Add Web site Profile
  3. Choose your profile type. If this is the first time you are setting up analytics, choose new domain. If you are adding another Web site within the same domain, choose existing domain. In this example we'll choose new.
  4. Type or paste in the URL of your site's domain. Note: If your site, like many Case sites, does not reside on the root of the domain, do not include the full path to your site, only include the domain. A complete URL, such as, will give you an error message as pictured here. Instead just include or whatever domain you use. (You will modify this later in step 13.)

    Create Profile

  5. Select your location and time zone then click continue
  6. On the Tracking Code page, you will see 2 options. Select New Tracking Code (ga.js). This will give you the tracking code for your site. The code will look something like this:

    <script type="text/javascript">
    var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    document.write(unescape("%3Cscript src='" + gaJsHost + "' type='text/javascript'%3E%3C/script%3E"));
    <script type="text/javascript">
    var pageTracker = _gat._getTracker("UA-1279047-11");

  7. Add the code to your site

    Instructions for those on the main Case server

    1. Create a new blank file in Dreamweaver or any plain text editor and copy the tracking number into the file. In our example the number is UA-1279047-11 as shown in red.
    2. Save this file as .googleanalytics. In Dreamweaver select "all files" in the "save as type" dropdown box to make sure no extension is added to the filename. If your program saves it as something like .googleanalytics.html or .googleanalytics.txt simply exit the file and rename it without the extension.
    3. Upload this file to the root or main directory level of your site. The server will use this file to embed the code into your pages.

    Instructions for those on other servers

    1. Copy the full code provided by Google and paste it into the bottom of each of your Web pages immediately above </body>. If you are using server side includes (ssi), templates or some other method for including standard content across your site, you can put this in which ever file controls the lowermost content on your pages. I generally put mine in the bottom of the .ssi file I use to include the footer on my pages.
    2. Upload your edited pages to your site.
  8. Click the Finish button. This will take you back to the Analytics Settings page. If you have a site at the top level of your domain and everything was installed correctly you should see "Tracking code installed Waiting for Data" under the status column to the right of your profile listing. Your installation is now complete and you can return in 24 hours to see your data.
  9. If, like accounts on the main Case server, your site is hosted in a subdirectory within your domain, you will see "Tracking code not detected" under the status column. This is perfectly normal and will be remedied in the following steps.
  10. Click Edit under the Settings column to the right of your profile listing. This will take you to the profile settings for your site.
  11. Click Edit in the upper right corner of the Main Web site Profile Information box.
  12. Change the name of your profile to one of your choosing.
  13. Replace your domain URL with the complete URL for your site. In our example we're using
  14. Type in the name of your default page. On the main Case servers we use index.html as the default pages within directories. Other servers may use default.html. If you're not sure, check with your server administrator or Web hosting provider.

    Edit Profile

  15. Click Save Changes to return to the Profile Settings page. On this page you can click on "Check Status" to make sure everything is working. It may take a minute or two for Google to process everything after which it should say "Waiting for Data -
    Analytics has been successfully installed and data is being gathered now
    ." Your installation is now compete.

Additional reference materials and instructions have also been provided by ITS as part of the new Aurora Project Administration System (APAS) Toolkit (login required).

Tracking .pdf, .mp3 and other downloadable files

As one of our campus Web maintainers recently observed, Google Analytics doesn't track downloadable files such as .pdf's by default. Google offers a way to do this by adding a small bit of code to each download link, but this requires you to edit each applicable link and move your tracking code towards the top of the page.

If you would prefer to install this on a site wide basis I recommend using the javascript solution offered by Good Web Practices. With this method you simply download their Google Analytics link tracking JavaScript, save it to a scripts directory on your site, and add <script src="" type="text/javascript"></script> immediately before the Google tracking code you installed at the bottom of your pages. Those of you using the Case .googleanalytics file method should add this to the bottom of your pages just above </body>—the same way maintainers not on the main server did to add the tracking code in step 7.

Advanced Techniques in Google Analytics

Get Adobe Flash player

Analytics Resources

StumbleUpon Toolbar Stumble It! AddThis Social Bookmark Button

Posted by: Heidi Cool June 18, 2008 10:02 PM | Category: Heidi's Entries , How-to , Recommendations , analytics , marketing


Trackback URL for this entry is: Tips for installing Google Analytics on Case and other Web servers.



Hey that's nice...thanks for your information

Posted by EGB on June 19, 2008 02:31 AM


Yeah for some things google analytics is nice but most times i prefere to control myself about my statistics and don´t wanna google to control it.
phpOpenTracker might be an alternative.

Posted by Web Consultant on June 23, 2008 06:46 AM


I agree with Dave, there are substantial differences between awstats and Google Analytics. I think part of the traffic differences are due to Analytics does not count search engine spider traffic.

Posted by Utah SEO on July 3, 2008 11:14 AM



I also use both Google Analytics and awstats. I also find awstats shows higher unique visitors (but not 2/3 higher) than analytics.

After some research I found graphs in both programs are similar. The peaks and valleys track very close. (Other than than the amplitude).

I ignore my own traffic in analytics. I haven't found a way to do that in awstats other than manually. Could this be your issue?

Wesley Slade
GO WebGuide

Posted by wslade on July 6, 2008 10:56 PM


I don’t use all the features in Google analytics, but never the less it’s good to read about them.

Posted by Peter on July 18, 2008 05:41 PM


I love Google Analytics, and its good to see Case is using it as well. My main features I use are referring sites, search engine keywords, and the content section to see what page is hit the most. This is one of my steps for every new website I launch. It must have Google Analytics in the footer so you know from day 1 how traffic is going.

Posted by Domains at Retail on October 17, 2008 01:40 PM


Google analytics is great tool, with many useful features. Sometimes I’m combining Google analytics data for traffic, visitors, pages with all data from hosting account. That way I got full picture what’s going on the site/blog.

Posted by Mike on November 11, 2008 04:45 AM



I love Google Analytics, and its good to see Case is using it as well. My main features I use are referring sites, search engine keywords, and the content section to see what page is hit the most. This is one of my steps for every new website I launch. It must have Google Analytics in the footer so you know from day 1 how traffic is going.

Posted by Dengesiz on November 14, 2008 03:57 AM


I have to be honest. I had great deal of problems making analytics to work on my blog. I presume that the problem is in WP theme. Something is blocking analytics code on this blog, but on all other it works perfectly.

Posted by Marina on December 4, 2008 11:57 AM


Is Google Analytics going to replace Webalizer as the standard for tracking unique visitors? I honestly don't want to bother with Analytics unless I have to...

Posted by Travel writer on February 14, 2009 04:56 AM


Google analytics got much more features than average webmaster needs.

Posted by Pinto on February 19, 2009 02:18 PM

Post a comment

Posted by: hac4 (Heidi Cool) June 18, 2008 10:02 PM | Comments (11) | Trackback