Integrated Marketing Success Factors 2020 - download yours for FREE right now...

Google Analytics Setup Guide

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 + "' type='text/javascript'%3E%3C/script%3E"));
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-UNIIQUE-ID-FOR-YOUR-SITE");
} 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
  • Sub-domains - For example, you may have a blog on a subdomain, for example fashion retailer ASOS has
  • Sub-folders - Alternately you may want to report separately on content in a subfolder, for example if your blog is configured this way,

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:

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
The name of the marketing campaign, e.g. Spring Campaign.
Media channel (i.e. email, banner, CPC, etc).

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

Who are you partnering with to push your message. A publisher such as, or for paid search, Google, Yahoo, Live Search, etc
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.
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: An example of the code which will group all internal links together in a folder 'internal-link' in Top Content is:

<a href="" 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 which redirects and appends a (non Google Analytics) tracking code referencing TV:

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");
    "1234",                                     // Order ID
    "Mountain   View",                          // Affiliation
    "11.99",                                    // Total
    "1.29",                                     // Tax
    "5",                                        // Shipping
    "San   Jose",                               // City
    "California",                               // State
    "USA"                                       // Country);
    "1234",                                     // Order ID
    "DD44",                                     // SKU
    "T-Shirt",                                  // Product Name
    "Green Medium",                  // Category
    "11.99",                                    // Price
    "1"                                         // Quantity  );

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


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


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.


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:


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.

Share your thoughts

  • Awesome guide and one of the best Google analytics guide i have found online. This is really helpful because the guide is really detailed with bits of information that even newbie marketers can understand.

  • DNS commented on September 23, 2014

    Does Google Analytics use not only reverse DNS, but DNS queries?

  • Firesit commented on March 1, 2010

    You have to check up these Google Analytics tips

  • Very useful overview. Many thanks for this. I too found Ran Mir’s second method – advanced segmentation – the better approach.

  • Ronan commented on November 18, 2009

    Hey Chris,

    Everytime I used the regexp eg ^/example/ and have it set as is contains I always get an “invalid subdirectory” message

  • Ronan commented on November 17, 2009


    When your using the regular express are you doing this as a custom filter or predefined? I ask as if I do a filter “include traffic > traffic to subdirectories> that contain ^/example/ I get invalid sub directory
    so I should be doing Custom Filter > Include > User Defined > ^/example/ ?

    Possibly a dumb question but driving me nuts 🙂


    • Ronan, Chris,

      It’s just a predefined filter to include traffic to a subdirectory with regexp: ^/blog/ – standard approach.

  • Chris commented on November 16, 2009

    Hi Dave,

    The way you have set up your profile so you have your main profile with the IP filters on it and then your sub profiles within it for the areas of your site – does that mean if you go into view reports on the top level report without the folder filtering you see the stats for the entire site so pages being tracked using the main profile AND all the sub profiles? I realise they all use the same GA code I just want to check the top level report doesnt exclude the subfolders you set up filters for.


  • Mark McGee commented on October 14, 2009

    Excellent article and one I’m reading through with care after today’s breakfast briefing in Manchester.

    One question comes to mind – our main site is built using Joomla and the GA tracking code is a plugin that affects every page. Would you have any recommendations for those of us currently using platforms such as Joomla or WordPress?

    Many thanks – looking forward to the next one.

    • Thanks Mark – glad this and the talk were useful. See you at the next one!

      The beauty of the GA tracking script is that it generally needs less configuration than other web analytics tagging tools which may need tailoring to define content groups or conversion events for instance. This means that you are probably not missing out through using a standard plugin, except when you need to add to the tracking script for tracking downloads or outbound links as we discussed (Step 7 above).

      To do this you will need to tailor the script within the page templating system rather than using a plugin. This should be straightforward for experienced designers. Hey, even I can do it.


  • RE: accuracy of GA goals.

    We’re a fairly IT led company when it comes to reporting, and experiencing difficulty with management buy-in of GA goal data (we’ve been running GA for 2 years now).

    When someone completes a goal, e.g. website registration, what % tolerance would you say is acceptable comparing to our CRM database?

    I’d be really interested to learn other people’s experiences of this!

    • That’s not a problem I have personally seen although have used GA in conjunction with Webtrends or Omniture – those were used for the enterprise reporting and GA for understanding inefficiencies in customer journey in which case the relative number of conversion goals and associated $Index value should be sufficient. Although your question does raise the issue of whether the relative values are accurate also.

      Relative to your CRM database you would expect them to be “congruent” i.e. deltas << 5%, so I guess the differences are bigger than that?

      Have you asked Question in the GA Groups?

      Do any other readers have experience of this?

  • The regexp code is incorrect in tip 10, you must remove the last dash (after bit\.ly), otherwise it will count all visits.

  • Steve commented on May 28, 2009

    Great article- covers some great quick wins 🙂

    One I’m keen to try is the social media segment (tip 10).

    I can’t seem to get this to work despite the segment being set up as detailed- once applied, the segment seems to count all traffic regardless of referrer or source.

    Am I missing something obvious?

  • Stan commented on April 6, 2009

    A friend in the UK said he was able to access the domain names of visitors to his website via googleanalytics. I can’t see how this is done. Is it possible that it is allowed in the UK but not in the US?

    • Hi Stan,

      It’s certainly possible in the UK where I’m based – look in the Network Location menu option of the Visitors menu in Google Analytics. A reverse DNS lookup is used of the IP address of the visitor network. Most of the entries are for consumer Internet Service Providers rather than individual visitors, but you can see visitors from individuals at companies also. I’m sure you can do this in the US also.


  • Hi Dave,

    Great post, right on the button.

    What is also worth mentioning from a business perspective is the new beta version of segmentation in Google Analytics.

    A simple example combining points 4 and 5 might be running a campaign designed to sell business services with the end goal being the prospect asks for more information via a form.

    By setting up a segment designed to see which sources of traffic from your campaign are the most effective you can quickly and easily optimize campaign spend. The segment could be something simple like “people who viewed the offer page”, or more complex like “people who viewed the offer, stayed on the site for 5 minutes and looked at 3 other pages of my site.”

    By doing this you might see that search campaigns work better (in terms of conversion or cost) than banner campaigns or vice versa.

    Avinash Kaushik also wrote a great article about GA’s features including how to set-up segmentation in a bit more depth;

    Google Analytics Maximized.


    • Hello Steve – it’s been a while.

      I did mention it in passing in Step 1, but thanks for highlighting it and providing the links to more info.

      By the way, your book must be nearly at publication stage? Look forward to seeing it in print. How / when are you going to do the announcement?


  • Nice post! Two comments:
    1) Check all your pages are tagged with WASP or SiteScanGA [I have a strong preference for the 1st!]
    2) Brian Clifton’s sample JavaScript to track outbound links & downloads talks about Urchin. I have recently blogged about a similar concept but using the latest GA Event feature and I will continue to enhance the script with other useful addons (like getting Google keyword ranking using events) Justin Cotroni Google Analytics short cuts is also a good reference (bet examples should be updated)

    Stéphane Hamel

  • Wil commented on January 23, 2009

    This was great. Very thorough and practical. You spoke to the level of the common user. We really appreciate it.

    Would you mind if I did a video series going through your each of your steps once a week for my blog?

    • “Thorough and practical”. That’s how I try to be useful, so it’s good to know when it’s appreciated.

      Doing a series sounds a fine idea. When you say video you mean screen capture or talking head? Screen “show and tell” would be good.

      Please link to the original and I will link it through to you.

  • Glad that timings good for you Daniel.

    You can track mailto: – it uses the same approach in step 7 – follow the link to BCs site and it shows how.

    Great idea on the Webmaster Tools for Marketers post – a lot of tips to write there, but will psyche myself up and maybe do that next month.

  • Thanks for the tips Dave,
    Just getting stuck in to putting all the google bits and bobs on to the site now. If you get a chance to post a few tips on the Google WebMaster Tools too that’d be perfect 🙂

    This guide was extremely useful though. Do you happen to know if events such as clicking on a mail-me link can be tracked through the google tracking?

  • And thank you Susan, for your comments and the spreadsheet tip.

    For anyone who doesn’t know Justin’s EpikOne blog I would recommend it for GA configuration tips and his E-book is excellent value although maybe a little out of date now in covering new features.

  • Excellent overview of managing Analytics in the real world, thanks Dave, and I’ll signpost it my blog readers.

    A couple of quick comments:

    You have two Step 5’s, and so that means it should be called “11 Step Guide…”

    I only noticed because I was reading it so carefully and wanted to make a suggestion for tagging links in Step 5. I recommend this spreadsheet from Justin Cutroni that makes the tagging process easier to do in a batch, and it also helps to keep things organised.

    Also, with regard to Vanity URLs (yes I know you hate that phrase), there is a real danger that punters will put the Vanity URL straight into the Google Search Box rather than the address box, which is a very typical Internet user behaviour … and of course theh search engine might come up with nothing, and in any event your tracking is skewed.

    Thanks for the great article

Get FREE marketing planning templates

Start your Digital Marketing Plan today with our free Basic membership.

  • FREE fast start guides to review your approach
  • FREE digital marketing plan templates
  • FREE alerts on the latest developments

Need help with your Google Analytics?

Get more from your digital marketing with in-company or remote training and consultancy from Smart Insights

Get FREE marketing planning templates

Start your Digital Marketing Plan today with our free Basic membership.

  • FREE fast start guides to review your approach
  • FREE digital marketing plan templates
  • FREE alerts on the latest developments