Clean up Your Google Analytics for 2010

Two dozen mobile carriers unite against Apple’s App Store
February 15, 2010
Jobs: Flash would murder the iPad. Really now, let’s be realistic
February 19, 2010
Two dozen mobile carriers unite against Apple’s App Store
February 15, 2010
Jobs: Flash would murder the iPad. Really now, let’s be realistic
February 19, 2010

It’s a bit late for a New Year’s-themed post and a bit early for a spring cleaning-themed post, but it’s never a bad time to get your Google Analytics data cleaned up. For those of you looking to do just that, here’s a “Quick Fix” checklist to put yourself on the path toward usable data.

1. Identify and resolve self-referrals
A “self-referral” is a visit for which the referring source is your own website. Self-referrals prevent you from seeing the original, valid referral information for the visits in question, so if you’re measuring ROI on advertising outlets, paid search placements, or offline campaigns, it’s important to reduce self-referrals to a minimal level.

First, make sure that every single one of your pages is tagged.  This can lead to situations where self-referrals occur.

Many self-referrals are a symptom of deploying Google Analytics without customizing your tracking code to track across subdomains (like blog.yoursite.com) or top-level domains (yourshoppingcart.com). Fortunately, this customization is fairly simple and easy to complete.

When a visitor to yoursite.com navigates, for example, to blog.yoursite.com or yourshoppingcart.com, GA’s default behavior is to set new cookies on the user’s computer, causing yoursite.com to appear as the referring website to a new visit that starts on the new subdomain or top level domain. However, by adding the following simple customization to your Google Analytics tracking code, you can ensure that GA preserves the pre-existing set of cookies, and therefore the original referral information persists throughout the entire visit.

For tracking across top-level domains:

On your first domain (yoursite.com), add the following to your tracking code before the trackPageview() call (obviously replacing “yoursite.com” with your own domain):

pageTracker._setDomainName("yoursite.com");
pageTracker._setAllowLinker(true);
pageTracker._setAllowHash(false);

On your second domain (yourshoppingcart.com), add the following to your tracking code before the _trackPageview() call (obviously replacing “yourshoppingcart.com” with your own domain):

pageTracker._setDomainName("yourshoppingcart.com");

pageTracker._setAllowLinker(true);
pageTracker._setAllowHash(false);

Now, for every link that you have on either domain that sends a visitor from one domain to the other, add the following bolded code:

<a href="http://www.a-different-domain.com" onclick="pageTracker._link(this.href); return false;">

If you have forms that submit across top level domains, you’ll need to add the following bolded code to each of those as well:

<form action="http://www.a-different-domain.com/form-processor.php" onsubmit="pageTracker._linkByPost(this);">

For tracking across subdomains:

This is MUCH easier than the above.  All you need to do is add the following line of code to your tracking code that appears on all your pages, regardless of the subdomain they’re on, again making sure that it goes above the _trackPageview() call:

pageTracker._setDomainName("yoursite.com");

For both subdomain AND top level domain implementations:

Lastly, you’re going to need to set up a filter to apply to each of your profiles so that you can see which (sub)domains your visitors are viewing in your content reports.  To do this, you’re going to create an Advanced Filter like this:

Filter Type : Custom filter > Advanced

Field A : Hostname Extract A : (.*)
Field B : Request URI
Extract B : (.*)
Output To : Request URI
Constructor : $A1$B1

To illustrate what this filter does, let’s say that you have an “index.php” on both www.yoursite.com and blog.yoursite.com. By default, Google Analytics will take all the pageviews for “index.php” and aggregate them on one line of data in your content reports. The problem here is that you want to be able to distinguish between those two URI’s, because they are NOT the same! The filter above will take “index.php” and prepend the hostname to it, so you’ll end up with TWO rows of data in your content reports: “www.yoursite.com/index.php” and “blog.yoursite.com/index.php” – and now you can see who’s viewing what pages.

Note that this will change the URI’s that Google Analytics stores, and if you have goals configured to match your old URI’s, you must update those goals once you’ve applied this filter.

With this customization in place, you’ll eliminate one of the biggest sources of self-referrals. Here’s an example of how you’ll benefit. Let’s say you’re running a Google AdWords campaign. You’ll now be able to track your AdWords visitors (and spend) end-to-end on your site, without the risk of losing track of them due to self-referrals. This is critically important for evaluating and improving the performance of any source of traffic.

2. Track all your goals
This sounds basic, but a very large proportion of Google Analytics users don’t track any goals at all, and most GA users that do track goals will only configure one or two. Now that you can have up to 20 goals per profile, you should be tracking every single goal you can think of. To do this, have a brainstorming session and write down every reason you have a website. For example, if you run an e-commerce website, your shopping cart will most likely be your most important goal, but what about tracking goals like these?

  • Newsletter sign-ups
  • Email to a friend
  • Buttons to bookmark/subscribe
  • “Contact us” submissions
  • Internal search

You could also track goals such as video views, specific content views, social media interaction, RSS feed clicks, blog comments left, and literally hundreds more. Using new “threshold goals,” you can even track time on site and pages per visit as goals.

It’s important to measure all of the value that your site provides. These “microconversions” will give you a fuller view of the performance of your marketing efforts, which will in turn help you make better decisions.

3. Tag your campaigns properly
Tagging campaigns properly is critically important if you plan to use Google Analytics to evaluate the performance of your various marketing efforts. Without proper tagging, it’s nearly impossible to use Google Analytics to evaluate the performance of marketing channels like:

  • Yahoo! Search Marketing, Microsoft adCenter and other SEM platforms
  • Banner ads, text ads, and other paid placements
  • Offline media like print, television, radio, direct mail, billboards, etc…

You can very easily link your AdWords and Analytics accounts and have Google auto-tag your AdWords campaigns for you, but for any other marketing channel, you’ll need to get your links tagged yourself. We recommend that you develop standardized naming conventions before you start to tag or re-tag your campaigns; this will promote consistency and minimize confusion and headaches down the road.

For example, for paid search campaigns, will you use “cpc” or “ppc” as your medium? For campaign names, will you use flight dates (“feb2010”), target audiences (“nascardads”) or something else? Once you have a naming convention in place, you can use Google’s free URL Builder to input your tagging parameters and get your campaigns set to go. Of course, you can always tag your links manually too. In either case, here’s what a properly tagged URL might look like for a Yahoo! Search Marketing ad:

http://yoursite.com/?utm_source=yahoo&utm_medium=cpc&utm_campaign=widgets&utm_content=smallwidgets&utm_term=little%20widget

Notice that we’ve defined the source of the traffic (”yahoo”), the medium (”cpc”, denoting cost per click), and the name of the campaign (“widgets”).  We’ve also used the optional parameters content (”smallwidgets”, which in this case is the name of the adgroup) and term (”little widget”, in this case the keyword we were bidding on).

IMPORTANT: Third party tracking mechanisms or URL shorteners often strip out these parameters, so make sure that any redirects that occur before a user reaches your landing page accept query string parameters.  If you click on your own ad and you end up at a URL like the above, you’re all set.

Cleaning up self-referrals, tracking all of your goals, and tagging your campaigns correctly will help you quickly get more accurate and actionable data in your Google Analytics reports.

via WebShare