Explore our Google Analytics Toolkit

Google Analytics Setup Guide

Author's avatar By Dave Chaffey 10 May, 2009
Essential Essential topic

A 12 step guide for marketers, designers and site owners

I've written this guide since I now find when training, that the majority of the marketers on the courses have Google Analytics installed on their websites.

But oftentimes, although Google Analytics is installed, it hasn't been configured to help marketers track and review their campaign or site effectiveness.In fact, when I take attendees through the configuration options, it seems very often little or no configuration has been done in their organisations!

So, I have written this guide as a checklist for non web-analytics specialists. It is a top-level guide, but I have provided links through to detailed descriptions on more specialist sites on the technical approaches needed to configure.

This  guide steps through all  main configuration concepts and issues to consider for using Google Analytics to improve your results from online marketing. I haven't seen any other lists that cover everything in a single list from a marketers point of view, probably because it's too much for a single-post!

If you want another way of assessing the work involved see our guide to 6 steps to Google Analytics setup and customisation.

If you are personally involved with configuration,  or want to know how to use some of the reports to improve results, I also recommend you buy [amazon-product text="Brian Clifton's book on Google Analytics" type="text"]/0470253126[/amazon-product] since this has more detail and examples than the Google Help files on Google Analytics configuration.

[amazon-product align="center"]0470253126[/amazon-product]

Justifying use of Google Analytics to colleagues

A barrier I encounter which stops some marketers using Google Analytics is that there may be questions from colleagues as to whether Google Analytics is suitable for medium  or larger businesses or whether it could reduce page load times, particularly if it is used alongside tracking tags for other web analytics system.

To help with justifying use of Google Analytics, I recommend taking a look at what competitors or large companies are using with Eric Petersen's Vendor Discovery tool which will show you which competitors or larger companies are using Google Analytics. Many are, often in parallel with other tagging systems.

Installing the Google Analytics tracking code

As the starting point for the checklist, I'm assuming you have already installed the Google Analytics tracking tags. This is straightforward in most content management systems which enable you to paste the Javascript code into a page template across the site.

If you haven't installed the tracking tags for a new installation, hold fire since some of the later configuration advice require these tracking tags to be amended.

The recommended placement location is towards the end of the page before the </body> HTML tag, but note that some of the configuration techniques below require a different location.

To give you an idea of the extent of the Google tracking code, for my site it is:

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-UNIIQUE-ID-FOR-YOUR-SITE");
pageTracker._trackPageview();
} catch(err) {}</script>

Checklist - configuring Google Analtyics for Marketing Improvement

Step 1. Review your approach to collecting data from different sites and services.

The granularity with which you collect and report data should be consistent with the way the organisation is structured since different people in the organisation will likely NOT want to review the results for the entire site, but instead you will want to separate out data for part of the company or a particular product, service or audience they are responsible for. Common options which you should consider to report separately on include:

  • Distinct domains - Many larger companies will use different domains for different services or audiences, for example using a different Country code top-level domain (ccTLD) such as .nl or .de as well as .com or .co.uk.
  • Sub-domains - For example, you may have a blog on a subdomain, for example fashion retailer ASOS has http://blog.asos.com.
  • Sub-folders - Alternately you may want to report separately on content in a subfolder, for example if your blog is configured this way, http://www.domain.com/blog.

To report separately on domains, sub-domains or sub-folders you need to apply the concepts of profiles and filters within Google Analytics. You may even want to have different accounts with different unique tracking codes for different countries, particularly if they operate as separate entities and you want to apply different currency and time zones to the report. Each account will use a different unique tracking code, but you will need to remember to include an aggregrate tracking code to report all the sites together.

A Google Analytics profile will typically be used to produce reports for different sites , subdomains or subfolders. Google Analytics Help on Profiles.

So, on my site I have a master profile that is unmodified for the entire site other than a filter for excluding my IP address together with other profiles for particular types of content such as blog content or visitor segments such as returning visitors. You should specify your default page for the profile, e.g. index.html.

Google Analytics Profile

Google Analytics Profile

A Google Analytics filter is applied to modify data from a particular profile so that it shows a subset of data within the profile. A filter will often be used to show visitor interactions with product information stored in a sub-domain or subfolder. Google Analytics Help on Filters.

In this example I have a filter which is applied to my Right Touching blog which only includes visitors who go to that sub-folder.

Google Analytics Filter

Google Analytics Filter

For example, a filter could restrict results to first time time visitors or returning visitors. With the Advanced Segmentation feature in Google Analytics you are effectively provided with several default filters, such as all visitors from

So you can see this is complex! You need to get this right from the outset of collecting data since profiles and filters cannot be applied retrospectively, applying filters incorrectly will introduece errors and introducing new profiles will lead to employee confusion.

Step 2. Exclude employees from report.

This configuration is relatively simple! You don't want visitors from a company skewing the results, so these should be excluded unless you want to artificially boost your visitor numbers and have difficultly understanding visitor behaviour.

A filter should be created to exclude a range of IP addresses for company employees and contractors working in different offices.

Alternatively, if staff have a range of IP addressses or dynamic IP addresses then using the _setVar function call on a page used by staff only (e.g. Intranet home page) to update a cookie to filter staff out. Both strategies are explained below:

Step 3. Define conversion goals.

Visitors to a site do not have equal value to a company, they engage to different degrees suggested by the types of pages they visit. A visitor who has visited a product page, registered for an e-newsletter, bought a product or visited the contact page is clearly more engaged - in web analytics we call these "value events".

Within Google Analytics these value events are known as "conversion goals" and they can be setup for an individual page such as the thank you page for an enquiry form or for a folder such as product pages or downloads. Only 4 goals are available, which is a limitation if you have many lead types or want to track individual PDFs. You can apply Ecommerce tracking to non-e-commerce sites to monitor additional value events through tagging individual pages with a call to the Javascript function getOrderID().

You should set a nominal value on each value event, so you can compare how different pages and referrers influence contributing to conversion goals.

Avinash Kaushik has a great post on the rationale and examples of conversion goals.

Step 4. Setup conversion funnels (optional).

Funnels representing the different steps in a checkout process are an essential piece of configuration for retailers. After these have been setup up you can then visualise the drop-off or attrition at each stage.

They can also be setup for sites showing how many people engage with different parts of the site which then contribute to a lead.

Step 5. Standard digital campaign tracking codes.

Defining a standard set of online marketing source codes is essential to determining the value of different referral sources such as ad campaigns or email campaigns.

Many companies will track AdWords because of it's automated integration enabled from Google AdWords, but they may not track other codes or have a standard notation which needs to be defined and then added to all links involving media placements.

Google Analytics uses 5 standard dimensions for a campaign which need to be incorporated into the query string of the URL for each ad placement as this example shows:

http://www.domain.com/landing_page.php?utm_campaign=spring-sale&utm_medium=banner&utm_source=handbag.com

The campaigns report in Google Analytics will then enable you to compare media.

The table explains each of these 5 dimensions which refers to this example:

Variable Explanation
utm_campaign
Recommended
The name of the marketing campaign, e.g. Spring Campaign.
utm_medium
Required
Media channel (i.e. email, banner, CPC, etc).

What is the 'distribution method' that is used to get our message out to our clients?

utm_source
Required
Who are you partnering with to push your message. A publisher such as handbag.com, or for paid search, Google, Yahoo, Live Search, etc
utm_content
Optional
The version of the ad (used for A/B testing) or in AdWords. You can identify two versions of the same ad using this variable. This is not always used and is NOT included in the above example.
utm_term
Optional
The search term purchased (if the link refers to keywords).
This is not always used and is NOT included in the above example.

The Google URL builder can help with creating these links.

Note that in the major Fall 2008 upgrade to Google Analytics, Advanced segmentation provides some standard source codes for campaign types such as paid search.

Step 5. Tracking internal links on-site promotions.

Although standard Google Analytics reports enable you to view paths through a site, it doesn't enable you to see clicks from individual links which is useful for optimizing sites by evaluating the impact of different calls-to-action and promotion containers such as links and buttons which lead to the same page. The Google documentation mainly refers tagging external links as campaigns.

You might think that the campaign tracking dimensions above would enable you to do this, but this approach is undesirable since the original referral information will be lost when a link coded in this way is clicked.

However, you can and should use this approach if you make extensive use of PDF collateral with links back to the main site.

It can also lead to indexing of different versions of the pages within Google which may have SEO implications (best to have links pointing to a single page).

There are alternative methods of achieving this, but a common method is to add an onclick event to a link which creates an additional PageView recording the link using the _trackPageview JavaScript function. This will inflate page views within Google Analytics, so these should be removed with a filter.

See this post for one implementation suggestion: http://www.viget.com/engage/how-to-track-internal-links-in-google-analytics. An example of the code which will group all internal links together in a folder 'internal-link' in Top Content is:

<a href="http://www.domain.com/destination-page/" onClick="javascript: pageTracker._trackPageview("€™/internal-links/green-button-A"€™)

Since this is a Javascript function it won't be followed by search robots when crawling the site.

Finally for one other type of internal link, Google Analytics introduced support for tracking of Flash events in 2008.

Step 6. Tracking offline campaigns

Many companies will reference promotional URLs or so-called vanity URLs (we hate that term) in offline Print ad, Direct Mail and TV campaigns to make it easy for the customers to fulfil the offer.

Of course, they also want to track the effectiveness of different promotions.

Best practice in such offline or multichannel tracking has been explained well by Avinash in his post: Multichannel Analytics: Tracking Online Impact Of Offline Campaigns.

The core technique is to use a 301 redirect which appends a campaign code. He gives the example of http://www.dell.com/tv which redirects and appends a (non Google Analytics) tracking code referencing TV:

http://www.dell.com/content/topics/segtopic.aspx/tv?c=us&cs=19&l=en&s=dhs&keycode=6Vc94&DGVCode=TV&dgc=TV&cid=11510&lid=985367

As with digital campaign tracking, offline campaign tracking should use standard codes for medium, source and campaign name.

Step 7. Tracking outbound or external links and downloads.

Unlike other web analytics tools and notably Index Tools (now Yahoo! Web Analytics) which has done this for 5 plus years, Google Analytics doesn't record external links and downloads without additional configuration! This is a pretty serious limitation for publishers and B2B lead generation sites which need to measure document downloads.

Help is at hand, since both external links and downloads can be recorded using a similar approach which uses a script developed by Brian Clifton. This uses a similar approach to that described previously for measuring internal links based on a virtual pageview, but it doesn't require individual links to be hand-coded, it is done automatically.

External links are recorded in content as a folder /ext/ and downloads in a folder /downloads/ and it should be remembered NB. that these are recorded as duplicate page views unless filtered.

However, it does require that the data collection script is moved to before the <head> part of the page template, it references an additional Javascript .js file and the body tag calls a script <body onLoad="€addLinkerEvents()"€>

Details on setup are explained by Brian Clifton in this post on tracking external links and document downloads.

With the launch of event-tracking in Google Analytics a better solution is this Javascript function from Stephane Hamel for  using Event tracking in Google Analytics to track external links clicked, PDF downloads and Mailtos]

This approach  is the best solution for using Event Tracking for External links and PDFs (rather than virtual page views which can inflate page views artificially unless removed with a filter).

Step 8. On-site search

Analysing the volume and types of searches completed by site visitors can pay dividends to find the type of content visitors are looking for and whether they can actually find it or leave the site frustrated!

These types of insights are available:

Google Analytics Search

Google Analytics Search

If you are using a Google appliance for search or Google custom search for providing on-site search configuration is straightforward. But other search engines can be integrated through specifying the query string parameters to Google Analytics.

Step 9. E-commerce tracking (optional).

E-retailers will need to enable E-commerce tracking for their Profiles since this isn't enabled by default. Ticking the tick-box will be straightforward.

The reports summarising E-commerce transactions and revenue within require inclusion of additional tracking code on the checkout completion page specifying order and product information.

Including the transaction information about the order and product(s) will be less straightforward, but many popular E-commerce systems will support this.

If you are coding this or inserting manually (e.g. for event tracking), in addition to the standard tracking code, the _addTrans() and _addItem() Javascript functions need to be included as in this example from Google:

<script type="text/javascript">
  var pageTracker = _gat._getTracker("UA-XXXXX-1");
   pageTracker._trackPageview();
  pageTracker._addTrans(
    "1234",                                     // Order ID
    "Mountain   View",                          // Affiliation
    "11.99",                                    // Total
    "1.29",                                     // Tax
    "5",                                        // Shipping
    "San   Jose",                               // City
    "California",                               // State
    "USA"                                       // Country);
   pageTracker._addItem(
    "1234",                                     // Order ID
    "DD44",                                     // SKU
    "T-Shirt",                                  // Product Name
    "Green Medium",                  // Category
    "11.99",                                    // Price
    "1"                                         // Quantity  );
 pageTracker._trackTrans();
</script>

10. Tracking and grouping visits from social media

I have added this step prompted by the excellent Econsultancy post by Ran Nir of Conversion Counts on 2 easy ways to track social networks in Google Analytics . I personally find it easier to use option 2 using Google's Advanced Segmentation, which will also give historic data (Option 1 is to setup  a filter). The steps Ran recommends are:

1. Head to 'Advanced Segments' in your main Google Analytics profile

2. Create a new segment and drag the 'source' box which under 'Traffic sources' to 'dimension or metric' window

advanced-segments

3. Open the 'Condition' drop down, select "Matches regular experession" and  paste the following sources:

digg|aim|friendfeed|econsultancy|blinklist|fark|furl|misterwongs|wikipedia|
stumbleupon|netvibes|bloglines|linkedin|facebook|del\.icio\.us|urner|
twitter|technorati|faves\.com|newsgator|PRweb|msplinks|myspace|bit\.ly

I preferred to call my segment "social media" and also note the 256 character limit and you have to go through to remove spaces.

The graphic below shows the results when I apply this segment to my "All traffic sources report in Google Analytics" - you can see that Twitter is most important for me (although this doesn't include visits via Twitter monitoring  tools like Tweetdeck) and that Facebook is also significant - my tweets are syndicated to Facebook as status updates and friends then clickthrough when interested.

social-media

Step 11. Configuring users, dashboards and emailing reports

Basic configuration of standard reports is possible through adding any report to to a dashboard through a button at the top of any  report.  Custom reporting is also available.

Emails can also be scheduled to send thse reports for different types of users.

Step 12. SERPS reporting of new Google query strings using filters
In April 2009 Google introduced an update to it's query string referring visitors from a search to a destination site which includes a cd=x parameter where x is the position in the natural listings Search Engine Results Page of the result that was clicked upon. This is very valuable since it reduces the need for rank checking services  like Advanced Web Ranking, Web Position Gold, etc to determine ranking positions which is partly why Google introduced the feature. Of course it won't show how your rankings compare to competitors, or where you aren't ranking.
You can also potentially compare your natural ranking position for a keyword with your average position for a paid search AdWords result to decide how you best integrate paid and natural positions.
To setup this tracking required setting up a separate profile for organic traffic and then creating customer filters as explained in these two articles:

Footnote

Well, that post took a while, but it seems that so many site owners and marketers have this issue, so I thought it would be worth giving a checklist to work to with links to more detail information.There's a lot more I could write about using Google Analytics for improving the results from search engine marketing and landing page optimization, but that will be another post.

Please let me know anything you feel is missing or inaccurate since I intend to keep this checklist updated as Google Analytics introduces new features.

Since I wrote this post and perhaps inspired by it, Future Now Inc have posted an excellent assortment of different blog posts and videos on configuring Google Analytics - essential reading.

Author's avatar

By Dave Chaffey

Digital strategist Dr Dave Chaffey is co-founder and Content Director of online marketing training platform and publisher Smart Insights. 'Dr Dave' is known for his strategic, but practical, data-driven advice. He has trained and consulted with many business of all sizes in most sectors. These include large international B2B and B2C brands including 3M, BP, Barclaycard, Dell, Confused.com, HSBC, Mercedes-Benz, Microsoft, M&G Investment, Rentokil Initial, O2, Royal Canin (Mars Group) plus many smaller businesses. Dave is editor of the templates, guides and courses in our digital marketing resource library used by our Business members to plan, manage and optimize their marketing. Free members can access our free sample templates here. Dave is also keynote speaker, trainer and consultant who is author of 5 bestselling books on digital marketing including Digital Marketing Excellence and Digital Marketing: Strategy, Implementation and Practice. In 2004 he was recognised by the Chartered Institute of Marketing as one of 50 marketing ‘gurus’ worldwide who have helped shape the future of marketing. My personal site, DaveChaffey.com, lists my latest Digital marketing and E-commerce books and support materials including a digital marketing glossary. Please connect on LinkedIn to receive updates or ask me a question.

Recommended Blog Posts