Tutorial #18
Setting up Google Analytics Basic   2013-11-13

Introduction

Tracking how people access your web site is incredibly valuable for a site owner. You can see what is and is not popular and you can learn the demographics of your audience.

Google Analytics is the big player in this field and many of the web sites that you visit contain hidden tracking code that passes back information to the site owner's account at Google.

The basic service is free and easy to set up. I'll show you what is involved in this tutorial. After you have used it for a while you will be seeing Analytics reports like this:

Demo 1 screenshot for this tutorial

Note that the Demo page for this tutorial is a bit of a non-event. It contains the tracking code but there is nothing 'visible' that happens when you visit that page.


Step by Step

1: Sign in to Google with your Google account and go to Google Analytics then click Access Google Analytics in the top right corner.

2: If you have used Analytics before, you will be taken to your account page, otherwise you will set up a New Account. You want track a Website and you want Universal Analytics. Fill out the form with an Account and your first Property (website). You can set up multiple properties under a single account.

Image 1 for this tutorial

3: The site returns a Tracking ID for your site and a block of tracking code that you will place in every page that you want to track.

Image 2 for this tutorial

4: Copy and paste that code into the bottom of every page on your site that you are interested in tracking - before the >/body< tag is the usual place.

Don't expect to see any visible change on your web page - in fact if it does look different then you have made a mistake copying the code!

5: Back on the Google Analytics site you won't see anything right away - so I'll show you what one of my other sites look like. Here you can see summary data on 4 sites.

Image 3 for this tutorial

6: Click on All Web Site Data to see a detailed (very detailed!) report. This gives you a breakdown of your visitors according to their location, which browser they use, whether they are on a mobile device, etc, etc.

Here are a couple of screenshots to give you an idea of the data that is available:

Image 4 for this tutorial

Image 5 for this tutorial

Until you have a lot of traffic, some of these reports don't mean a lot. But it is worth spending some time learning what Analytics is capable of. Google have a number of articles and tutorials available under the Help menu.


Understanding the Code

The tracking code looks pretty cryptic and we can't modify it anyway. But what it appears to do is load the analytics.js script from Google and creates a function called ga. It then calls that function with a create action, passing it the tracking id and your internet domain. It follows that with a second call with the send action that I assume actually sends the information to your account at Google.

It should be obvious that the tracking code shown here is specific to my site. You need to generate your own tracking code on the Analytics site under your own account.

There is no problem with making your tracking code public. It is inherently linked to your web site and so no one else can use it. In fact it has to be public in your web pages in order for it to work.


Code for this Tutorial


Share this tutorial



Comment on this Tutorial


comments powered by Disqus