Google Analytics: Setting yourself up for success

Google Analytics (GA) will serve you better if you filter out spam, block internal or irrelevant traffic, and set up Content Grouping. Any organization with a website will benefit from properly configuring GA, but digital services agencies in particular should be setting up their clients to succeed with these simple steps.
This walkthrough will take 15-20 minutes to get through, but you’ll end up with a Google Analytics configuration that will help you measure far more than the basics. Just here for the steps? Skip to filtering out Google Analytics spam, blocking IPs from Google Analytics, or configuring Google Analytics Content Groupings.

Setup GA before you launch your website

Neither Filters or Content Groupings work retroactively. That means that the spam you filter out and the Content Groupings you setup to observe only start helping you from the day you turn them on. While it’s still possible to filter out analytics spam from historic data using Segments, Content Groupings simply can’t be applied to old data. Getting the right setup in place from the beginning will save you a lot of headache.
Here’s the specific benefits of following the steps below to configure GA properly from day one:

  • Remove analytics spam. Unless you’re filtering out analytics spam, your traffic numbers, bounce rates, time on page and other metrics aren’t accurate. The erroneous metrics associated with GA spam injected into your account are getting wrapped into your site’s overall metrics. You don’t want to be making decisions on incorrect data.
  • Filter irrelevant traffic. You don’t want to be logging new visits while your content editors create content or your employees browse internal content pages. You probably want to block GA from tracking a variety of internal or organizational traffic so your reports accurately reflect the behaviors of your audience—not your editors, employees, etc.
  • Configure Content Groupings. If you want to know how many users reading blog posts end up on product pages (that’s just one example), you’ll need Content Groupings. Understanding how users move between arbitrarily defined groups of content can unlock a whole new level of insight into the user behaviors your website encourages, and how to engineer those behaviors to include more high value interactions.

With the step-by-step walkthrough below, you can set up your GA account for success in less than twenty minutes.
NOTE: This post is about your initial GA setup, and doesn’t cover filtering spam or otherwise misleading records out of your existing GA data. To filter out data from your existing GA records, you’ll want to set up Segments which are covered well in this post.

Create a View for your Filters & Content Groupings

The first thing that you’ll want to do is create a new View in your GA account to house your Filters and Content Groupings. You can call this view whatever you want, but a name that reflects some of the specific behaviors you’re hoping to measure might make the most sense.
Once you’re logged into GA, select the Account and Property you’ll be working with, then select Create new View from the pulldown beneath View. We’ll call our view Example View.

Remove analytics spam

Analytics spam is a general term for erroneous visitation records injected into your GA account from illegitimate sources. Spammers simply execute some Javascript code that makes a call to GA and passes it false information to record in your GA account, all without ever visiting your website. If you have a pre-existing Google Analytics account without spam filters, you can check out your spam records by going to your GA dashboard and clicking Reporting, Audience, Technology then Network. Generally speaking, any domain in the first column (Hostname) that you don't own and administer is spam. Yes, that includes www.bbc.com and how.to.travel.and.make.money.online.for.free.with.maps.ilovevitaly.com.

Why do spammers spam? Only Nigerian princes who make $5,000 weekly working from home really know.
Analytics spam pollutes your reports and skews your data. Fortunately, it’s pretty easy to remove. We’ll be setting up four different filters to remove spam from your analytics account. In all of our examples, we’ll be referring to our website as mywebsite.com—just change that for your own website. Start by clicking Filters, then + Add Filter for each filter below.

Valid Hostnames. This removes any data that wasn’t transmitted by your website. This is one of the most basic and most important filters.

  • Filter Name: Valid Hostnames
  • Filter Type: Custom
  • Include / Exclude: Include
  • Filter Field: Hostname
  • Filter Pattern: mywebsite.com

Crawler Spam A. This is one of two filters for removing spam created by automated, non-human crawlers.

  • Filter Name: Crawler Spam A
  • Filter Type: Custom
  • Include / Exclude: Exclude
  • Filter Field: Campaign Source
  • Filter Pattern: geshifilter-code-seo|(videos|buttons)-for|anticrawler|^scripted.|semalt|forum69|7makemon|sharebutton|ranksonic|sitevaluation|dailyrank|vitaly|profit.xyz|rankings-|dbutton|uptime(bot|check|.com)[/geshifilter-code]

Crawler Spam B. This is the second filter you’ll need for removing crawler spam.

  • Filter Name: Crawler Spam B
  • Filter Type: Custom
  • Include / Exclude: Exclude
  • Filter Field: Campaign Source
  • Filter Pattern: datract|hacĸer|ɢoogl|responsive-test|dogsrun|tkpass|free-video|keywords-monitoring|pr-cy.ru|fix-website|checkpagerank|seo-2-0.|platezhka|timer4web|share-buttons|99seo|3-letter

Language Spam. This removes spam recognized by the use of illegitimate language codes.

  • Filter Name: Language Spam
  • Filter Type: Custom
  • Include / Exclude: Exclude
  • Filter Field: Language Settings
  • Filter Pattern: \s[^s]*\s|.{15,}|.|,

That’s it! Once your filters are saved, you won’t have to worry about dealing with spam in your analytics account. Now it’s on to filtering out irrelevant traffic.

Filter Irrelevant Traffic

If you’re a publisher, you probably want your GA account to reflect accurate numbers about your readers—not your content creators, editors and other internal users. The same goes for digital agencies, nonprofs and more. In most cases, you want to see how your users interact with your website, not your employees or yourself.
Filtering out internal traffic is easy to do if you have a static IP. Otherwise, it can be a little more complicated. To filter out your static IP, just create the following Filter using the same process as above:
Internal Traffic. Here we exclude all traffic from a specific IP, perhaps something like your office or home.

  • Filter Name: Internal Traffic
  • Filter Type: Custom
  • Include / Exclude: Exclude
  • Filter Field: IP Address
  • Filter Pattern: 110.111.543.256 (Your IP here)

You can also include multiple IPs, but you’ll need to prefix every period with a backslash, and separate IP addresses with a pipe. Here’s an example: 444\.34\.126\.87|178\.32\.155\.199
That’s it for filters. Your filters should look something like the image below now.

If you don’t have a static IP, you still have some options. If you have a Drupal website, consider using the Drupal Google Analytics Module to prevent logged in users of certain roles from reporting analytics data. If you’re using Wordpress, the Google Analytics by MonsterInsights plugin has similar functionality.
Now that you’ve filtered out irrelevant visitor data, it’s on to Content Groupings.

Configure Content Groupings

Content Groupings let you group bodies of your website’s pages together using rules or sets of rules, then measure how users progress from one group of pages to another. Why use Content Groupings? Content Groupings help you analyze, and ultimately shorten, a user journey that begins with landing on your website and ends with a high value interaction like buying a product or visiting a contact form.
Each Content Grouping you configure will consist of several rules used to group content in your website together. Later on when viewing your GA Reporting screen, you’ll be able to select a Content Grouping you configured from inside the Behavior Flow report to see how traffic converts between each of the groups you’ve defined within that particular grouping.
To set up Content Groupings, navigate to your GA home screen, then click the Admin tab. Choose the Account, Property and View for which you want to add Content Groupings—probably the same View we’ve been working with above to define your spam and internal traffic filters. Once you’ve selected the right View, click Content Groupings, then + New Content Grouping. You’ll want to name your Content Grouping to reflect the type of behavior you’re trying to monitor. For our example, we’ll go with Example Groupings.

There are three methods of grouping your pages together: Extraction, Tracking Code and Rule Set. The extraction method lets you add pages to a group using regular expressions compared against the URL or Page Title. The Tracking Code method lets you add pages to a group by configuring a page of your website to include a specific Javascript snippet. The rule set method uses a simplified version of the extraction method, wherein rules like If page title contains or If page title exactly matches are used in place of custom regular expressions. For this example, we’ll focus on the flexible and easy-to-use Rule Sets.
When thinking about Content Groupings, try to imagine the pages that users might visit during their journey to the behavior(s) you’re most interested in measuring—your high value interactions. If we’re interested in how Blog pages relate to About or Contact pages, we’d want to think about how users get to—and between—each. For this example we’ll define several stops along potential user journeys.

For each rule you’ll click Create a Rule Set under Group Using Rule Definitions, add a name for your rule, then define the rule. Here are some examples, note that Page here means URL—so you’re using rules to match against the pages’ URLs which you’d like to be part of the group.

  • Home: Select Page, exactly matches and enter /. This defines your Home page as its own group.
  • About: Select Page, exactly matches and enter /about. This defines your About page as its own group, assuming the URL is /about.
  • Blog pages: Select Page, contains and enter /blog/. This defines a group for all blog pages, assuming all of your blog post URLs begin with /blog/.

Once you have all of your groups defined, you’ll need to wait a few days to capture data. Unlike segmentation and other manipulations of Google Analytics data, Content Groupings can only be applied to data captured after they’re configured. Following our example above, I’ve configured a few more segments within our Example Groupings: Blog, Work, Work Pages, Services, Contact. You can see how this might work in the example of the Behavior Flow report below.

The Behavior Flow report (under Reporting, Behavior, Behavior Flow) lets you choose a Content Grouping (Example Groupings) and a first measurement (Browser), then show which of your defined groups users land on, and how they progress through your website group by group.
That’s it! With spam filters in place, irrelevant traffic removed and Content Groupings set up, you’re ready to start collecting useful analytics.

Education Process

Read This Next