Helen Sargan <hvs1001@cam.ac.uk>
This is a very personal introduction to Google Anlaytics. I have learned it as I have gone along and there are areas that I ignore. This introduction is very much on the basis of what I find really useful, but it should be a good way to get you started. It is divided into sections
If you use logging analysis (that is based on your server logs) alongside Google Analytics you will see that the figures are not directly comparable, although the shape of the graph of usage should be similar. This is because Google Analytics uses client-side code to gather information (depending on JavaScript and acceptance of cookies), whereas most log files contain only server-side information. Google Analytics does not track spiders and bots. Log files, however, record every time a file is requested, regardless of who requests it. Both are of use but can and do misrepresent what's going on.
There are EU regulations that cam into force May 2011 that make it necessary to warn people about cookies being used on your website and, if necessary, give them the opportunity to opt out of their use. This isn’t necessary if the cookie is for business purposes, such as those used by Raven, but is necessary for other types of cookie, including Google Analytics cookies. Currently Legal Services are deciding what statement should be used in a cookie policy on web servers, and we have yet to find a proven technical answer to seeking agreement for cookie use.
When setting up your analytics account you should opt that Google Analytics does not share your data – you can change to this setting after the account has been set up.
Google Analytics is free of charge (although there is now a paid-for 'premium' service – see http://www.google.com/analytics/premium/features.html). It works by the inclusion of a block of JavaScript code on each page in your website. When visitors to your website view a page, this JavaScript retrieves data about the page request and sends this information to the Analytics server.
The data that Google Analytics uses to provide all the information in your reports comes from these sources:
So the information in Google Analytics tells you about the frequency pages on your website are requested, the journeys users are making through your pages and much other information about where the requests come from. For commercial companies there are emphases on tracking whether advertising campaigns (via AdWords) are successful, and if transactions are being completed, but for non-commercial websites you can learn valuable information about whether links and pages are used and where users enter and leave your site.
A new version of Google analytics became available last year, which is covered here. The old interface is still available.
The first thing you need is a Google Analytics identity (http://www.google.com/analytics/sign_up.html) - to get one you will need a Google account, so if you don't have one you'll have to do that first (https://www.google.com/accounts/NewAccount). When you log into Google Analytics (http://www.google.com/analytics/)within your Google Analytics administrative area are your accounts in which you can track any number of items (web sites, parts or amalgams of websites, which Google calls 'web properties'). You will also see an overview that includes any accounts that you have been given access to and allows you start a new account if you need to.
If you use Google Apps @ Cambridge for Google Calendar, and are currently Raven-authenticated to it, when you try to log into Google Analytics you will be told the service is not available. Follow the ‘Sign out’ link so that you can sign in with your Google account.
When you request an account you receive a tracking code that you then add to your pages. Choose an appropriate name, although you can change both it and the url afterwards.
Once you have completed the request, you will be able to choose to change what you initially requested in part 1 of the page, and this will change the code offered on part 2 - the right of the page (but you can change this by hand later).
Your tracking code will look similar to this, but the xxxxxx-x will be your web property id-profile number (so the first value will always be xxxxxx-1):
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxxxx-x']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript';
ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' :
'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
</script>
You need to copy the code in part 2, keep a copy safe and then paste it into your pages, just before the </head>tag (there is an option to email it as well). When you complete the process you will be taken to a page for the new account.
When you set up a profile for a website, data tracking begins as soon as the tracking code is installed on the website and a visitor's browser loads a page. The data is stored in a 'profile'. When you already have a functioning profile for an existing website, and you add an additional profile later on in time, the additional profile will not contain the historical data that you see in the profile created earlier.
The main resaon for adding additional profiles is to allow people read-only access to data about sub-sections of the site you are tracking. Important things to remember are:
When setting up tracking in an Analytics account, it is a best practice to make the first profile for a property a master profile. A master profile should have no filter to exclude or include sections of the data from the site being tracked. In this way, you will have a profile for the web property that contains all historical data since tracking began.
If you do not set up a master profile, but instead have profiles with filters excluding particular parts of your website, you will not have any data for the parts that have been excluded by the filter. For example, suppose you are mainly interested in tracking visitors to your site from the United States. If you set up a filter on a single profile that includes only traffic from the U.S., you will never be able to see pageview data for traffic from anywhere but the U.S.
If you want filtered profiles, we recommend setting up two profile types: one to track all sections of the website, and all visitors, and other ones more suited to a particular objective that excludes certain data. The master profile should also be the first profile you establish for your site.
If in your initial set up you left the tracking code looking at a single domain (which was the default), you can change it by editing the tracking code. (There is an overview and examples on the page https://developers.google.com/analytics/devguides/collection/gajs/) This is useful for the following circumstances:
To track subdomains in the same profile as the domain, first you will need to alter the tracking code on each page by adding the line shown here in italic (this example assumes your main domain is csx.cam.ac.uk):
_gaq.push(['_setAccount', ' UA-xxxxxx-x ']);
_gaq.push(['_setDomainName', '.csx.cam.ac.uk']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_trackPageview']);
In order to then be able to differentiate in reports to which subdomain the request belongs, you will have to add a filter to a copy of the profile that adds the URI to each string. See Adding filters
A less likely scenario but you can find out how to cope with it at https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingSite
Demo of 'Main UCS site' profile
Filter Type : Custom filter > Advanced Field A : Hostname Extract A : (.*) Field B : Request URI Extract B : (.*) Output To : Request URI Constructor : $A1$B1This is a standard recipe filter that can be found on Google
Each time you want to set up a filter, add a new profile to do so. If you filter the data being collected you can't ever retrieve the uncollected data, so you don't want to risk not collecting data you want for other purposes. In addition when you set up a new profile you can adjust the list of users who have access to it (and only to it). The most usual reason for adding a filter is when you have a subdirectory of information that is of interest to a division or department and they want to see reports. So, for instance, I have added a new profile called 'Wireless' by:
To add a filter to show only requests for pages in www.ucs.cam.ac.uk/wireless/, the following criteria are needed:
Filter name: wireless Filter type: Predefined Pop-down choices wanted are: 'Include only' 'traffic to the subdirectories' 'that contain' Subdirectory name: /wireless/ Case sensitive: No
If you look at the options in the pop-down lists you can see what sort of filters can be made in this simple way. Once this is saved you will be returned to the screen about the profile - now with the filter added - and here I could add a user who could access this data in this profile. To do this you select '+Add User' from the 'Users with Access to Profile' bar and add their email address (which must be a Google account). If you make someone an administrator for the account they will be able to access everything - you can't restrict any profiles.
When you go back to the 'Analytics settings' page, you will see that the Filter Manager now lists that there is an additional filter.
To see data collected in the accounts, you need to go to the top orange bar and select the left-hand option, then click on ‘Accounts list’ (by default this list is what you will see when you first log in to GA). By default it will show you
In the list, select property you want to look at and then click on the appropriate profile. You will see a ‘Visitors Overview’ page that shows a set of overview information gleaned from the data collected. By default it will show you
From the beginning, don't expect everything to be useful for you. Sections of Google Analytics are aimed at commercial users. Concentrate on getting data that's of help. Particular strengths are
Select the Content > Overview in the left navigation to see what options are available. Most of the options for viewing pageviews for pages are self-explanatory.
Looking at the results, the first link is more popular than the others.
A "bounce" is described as a single-page visit to your site. In Analytics, a bounce is calculated specifically as a session that triggers only a single GIF request, such as when a user comes to a single page on your website and then exits without causing any other request to the Analytics server for that session.
A bounce is a different metric than an exit, since the page being examined is the only page visited. There is a full explanation at http://support.google.com/analytics/bin/answer.py?hl=en&answer=2525491.
The analytics view is that bounces are bad since they show you are losing your user as soon as they arrive. However, for a page imparting a single topic of information or a page people use as their start page, a high bounce rate might be what you expect. For instance the page http://www.ucs.cam.ac.uk/docs/faq/m8.html gives instructions on a very particular subject. Looking further, almost all of the requests are from external sources, most from Google searches. By looking at the 'Entrance keywords' you may be able to see what searches brought them to the page.
To access this select the pop down arrow next to 'Advanced segments' in the top of the Dashboard screen. You can apply some default filters to show a breakdown in your visitors by a selection of predetermined criteria (one of which is 'mobile users', which can be quite useful) or by creating and applying criteria of your own (for full information see http://support.google.com/analytics/bin/answer.py?hl=en&answer=1033017
I have set up a custom segment that gives an approximation of Cambridge users - it uses the Dimension 'City' which matches exactly to the value Cambridge.
To produce a report of any data, you can go to either the 'Export' or 'Email' tabs in the top of the Dashboard window and select the appropriate format (this has only just been added to the new interface for Google Analytics and may still be incomplete).
The email option allows you to schedule report sending to a group of users - which may be ideal when you set up a profile filtering only a sub-set of your information and you wish to send it regularly to those who requested it.
You can build your own custom reports if you want to , including specific dimensions and metrics – there is excellent help information at http://support.google.com/analytics/bin/answer.py?hl=en&answer=1033013
Since www.cam.ac.uk is essentially a hub to other information in the University we have a lot of links that go outwards, whose use we like to track. We have other pages (particularly the home page) where we want to know how many times a particular link is used. In the same way, there are downloadable files for which we would like to know the frequency of use. The following technique is suitable for tracking all of these. The answer is to add a piece of javascript to the link on the web page so that the clicking of the link records a use. The first thing is to decide upon a virtual pageview location and name. We use /outgoing/ and then allocate a suitable name that identifies the link being tracked – for downloads we use /download/ and a suitable name. The code added into the link is in bold in the following example:
<a href="http://www.example.com" onclick="_gaq.push(['_trackPageview', '/outgoing/example_com']);">
On viewing the Google Analytics report and filtering for /outgoing/, the number of requests for all such marked links will be shown.
If you have some particular targets on your site and you want to measure how often and how effectively they are used and the routes used to get to them, you can extend the above technique and set up a goal and the route you'd expect them to take (see http:/support.google.com/analytics/bin/answer.py?hl=en&answer=1012040).
It might be useful for you to know what browsers your visitors are using and how this is changing over time. To do this you Go to ‘Audience’ in the left hand navigation and choose the ‘Technology’ pop-down, and then select ‘Browsers & OS’. You can then combine this with a secondary dimension, to show, for instance, browser versions.
(See 'Expanded information' in handout for more detail) Sampling in Google Analytics or in any web analytics software refers to the practice of selecting a subset of data from your website traffic.