Tips, Tricks, Tools & Techniques

for Internet Business, Life, the Universe and Everything

RSS Feed



How to install a web analytics tool the right way

28 September, 2007 (13:20) | Testing, Tools, WordPress | By: Nick Dalton

Welcome to the first installment in the Tracking, Testing and Tweaking Your Web Site series. If you haven’t yet suggested topics you’d like to see covered in the future, it’s not too late to do so.

In this first article I’m going to cover installing a web analytics program for your web site. This is the first tool that you should to get into place to track your visitors. Even if you’re already using Google Analytics or a similar tool, please read on as there are some important tips in this article that will help you later on.

Web Analytics Tools

Your web hosting account probably came with a web statistics tool like Webalizer or AWstats. These tools can show you some statistics about your visitors and their page views, but they do not track visitor behavior very well. So ignore those tools.

The “installation” of most modern web analytics programs consist of adding a little piece of JavaScript code to each web page on your site. Since this code needs to go on every page most vendors recommend that you place it in the footer of your site (assuming that you have a footer file that is included on all web pages). There is another reason for placing the code at the end of the page: The JavaScript code takes some time to execute and if it’s at the bottom of the page the visitor will be able to view and read the full web page while the browser is processing the web analytics JavaScript. However if you want to do some more advanced web analytics, installing the JavaScript at the end of the page is sometimes the wrong thing to do. More about that later.

I suggest you use two different web analytics tools: one simple tool for real time information and another one for more advanced analytics. Real time information can be useful to react to abnormal traffic. For example: Last week one of my old blog posts became popular on StumbleUpon and I received over 500 visitors within a few hours. While it was a good blog post, it didn’t have any affiliate links. So I quickly added a few to capitalize on the traffic surge.

There are many, many web analytics tools to chose from. The simple tools have similar basic web analytics features and offer detailed data on the last 100 – 500 page views for free. If you want a larger buffer you have to pay a monthly fee. (Obviously if you’re receiving 10,000 page views per day then 500 is only going to last you an hour or so which is probably not all that useful.) The advantage with these simple tools is that the data is shown practically in real time. You can literally follow along as visitors are surfing your site. Not that this is good use of your time…

StatCounter

The simple web analytics tool that I use is StatCounter. Sign up for a free account and then answer a few questions about your site. Of these questions there are a few that are significant: Make sure that you add your own IP address to the IP Blocking section so that your own page views on the site are not included in the stats. StatCounter helpfully displays your current IP address next to the entry window, e.g. 76.81.54.162. If your ISP doesn’t give you a static IP address you can block out a whole range of addresses with a * at the end (76.81.54.*). If you still see your own traffic occasionally you might consider blocking an even larger range (76.81.*.*).

The other important configuration with StatCounter is the look of the “counter”. In the early days of the web it was cool to display a counter on your web pages to show how popular your site was. For a business web site this looks very unprofessional, so you should be sure to select the “Invisible” counter.

After all the questions are answered you will get a snippet of JavaScript code to install on your web site. It will look something like this:
<!-- StatCounter -->
<script type="text/javascript">
var sc_project=xxxxxxx;
var sc_invisible=0;
var sc_partition=29;
var sc_security="xxxxxxxxx";
</script>
<script type="text/javascript" src="http://www.statcounter.com/counter/counter_xhtml.js"></script><noscript><div class="statcounter"><a class="statcounter" href="http://www.statcounter.com/"><img class="statcounter" src="http://c30.statcounter.com/xxxxxxx/0/xxxxxxxx/0/" alt="website stats" /></a></div></noscript>

This JavaScript code should be added just before the </body> tag at the end of each of your web pages. If you’re using WordPress, the file to edit is called footer.php within the Theme you have selected for your blog. After you have added the code, do a View Source with your browser to make sure that it was installed correctly. If you do a View Source on this web page and scroll down to the bottom you will see what it should look like. Also with the real time nature of StatCounter you should quickly start seeing traffic statistics in the tool.

Google Analytics

The other web analytics tool that I use is Google Analytics. It is pretty advanced and you can’t beat the price: free. (You may have to sign up for a Google AdWords account to use Google Analytics, which may require a $5 activation fee. But there is no requirement to actually spend money on AdWords to use Google Analytics.)

In Google Analytics you should also block your own IP address. This is done in Analytics Settings -> Profile Settings -> Add Filter. Select Filter Type “Exclude all traffic from an IP address” and then enter your IP in this format: 76\.81\.54\.162 (Google uses powerful regular expressions here, hence the backslashes in front of each dot. Click on the help link for more information.)

I recommend that you place the Google Analytics JavaScript code in the <head> section of your web pages. This may seem counter to what I said above. But GA offers a feature called urchinTracker that allows you to track outbound links, among other things. To use urchinTracker the GA tracking code must be placed before any links or events that try to call it. The <head> section is a good place to ensure this.

For WordPress users the file to edit for the <head> section is header.php. If you’re not comfortable editing PHP files then there are several WordPress plugins that make it easier to install web analytics tracking code. Just make sure you get a plugin that allows you to control where on the page the code is added.

Again View Source on this page to see what the completed installation should look like.

That completes the installation of your web analytics tools. I know this was a very brief tutorial, so if there is enough interest I may create a Camtasia video to illustrate each step.

Comments

Comment from Linda Starr
Time: November 11, 2007, 20:06

Thanks so much for your insight into the web analytics topic! This really clarifies how to proceed for me–thanks. My husband and I met you in Long Beach at JV Alert Live! and I finally decided to check out your site….it’s fascinating and unique (and I really mean that having been to many, many IE–Internet Marketing–websites :) Thanks –Linda

Write a comment