fcOnTheWeb Logo Web technologies, made easy.

fcOnTheWeb Red DotGoogle Analytics - Why you need it and how to get it

Yet another great service the kind people at Google are providing us is some user tracking - Google Analytics.

Google Analytics allows us to leverage Google's massive power on the Internet to gather statistics about our visitors. We will go into which statistics in a little bit, but they are pretty much everything you want to know. We can then access this data through the Google Analytics site, and it is presented to us in report and graph form - over selectable time periods - allowing trends over time to be easily seen and compared. And of course letting Google do all this work for us saves many development hours re-inventing the wheel.

We will cover three points in this article:

Why use Google Analytics?

So why should we use Google Analytics? Why have user tracking?

There are three reasons why you should have Google Analytics on your website: to identify your target audience, to judge the success of your content and to monitor the keywords people are using to get to your site.

Identifying your target audience is important as it will help you to write content and create a site that is better to suited to the people that use it. And Google Analytics can help you by tracking many statistics about your users. It tracks and provides you information such as the location of your visitors, their screen resolution, their browser and version, their Flash Player version, their operating system and much more.

Already, with just these statistics, you can see how you will be able to better a tailor a site to those who are actually using it. All of this data is presented in both report and graph form so it is very easy to read and decipher.

Google Analytics can also help you to judge the success of the content you are creating. It does this by allowing you to see how many page views your content has created, and how long people have spent viewing the pages on your site.

For example, if the average time spent on each page is just a few seconds then we can assume that users aren't finding what they want and are leaving without reading your content. However if the average time spent is a minute or more, this indicates that users are indeed reading the content on your web page and more than likely finding the information they were after.

Another feature available is the ability to track search engine traffic and the keywords used. That is, you can see which search engines (and indeed other sites) are sending traffic to your site and what keywords are bringing users to your content. With this knowledge you can then target similar keywords to optimise your content, or see which of your keywords are not bringing the traffic you thought they would.

How does Google do it?

So, how do Google track this information about your site? They do it by allowing you to add to your site some JavaScript they have written.

This JavaScript is then executed on the pages you want and it records all of the data back to the Google servers and your Google Analytics account.

All the hard work of writing the JavaScript and getting it to work in multiple browsers is all taken care of by the friendly and always giving Google developers and we don't have to worry about any of it. All you have to do is add the necessary code to your site pages.

How can we get it on our site?

Actually getting Google Analytics on your site is probably one of the easiest things you can do.

Firstly, go to the Google Analytics homepage - http://www.google.com/analytics/ - and sign if you already have a Google account, or create one if you don't.

Next, simply enter your site name and the other simple details asked over the next couple of signup pages.

The site will provide you with a section of HTML/JavaScript to insert into your web page. This is the code which calls the JavaScript files and functions which reside on the Google servers. It is this code that performs all the magic. It is recommended this code is added at the bottom of your page, immediately before the </body> tag.

For a large and/or dynamic websites the best way to do this is by having the code reside in one location and then "including" it on the required pages, or perhaps writing the code out with a function call. This works best as it means there is only one piece of code to be updated if it is ever needed, yet it can readily and easily be deployed across many page instantly.

How the code is included on your page will be specific to the technologies you are using - HTML, PHP, ASP.NET, etc. - but the results will all be the same: the ability to leverage the power Google Analytics to your advantage.

ferrari_chris


Add your comment on this article below:

Sorry, there's an error with your form entries. We really appreciate your comment, so please try again.

Form submitting now...

Name:

Website:

Email address (not displayed):

Enter your comment below: