SHARE

Google Analytics Filters

Introduction

The more I learn about Google Analytics, the more amazed I am with it as a platform. I mean sure, it can simply track one’s web traffic to a single domain, but with some fairly simple tweaking, it can do so much more than that. This will be the first in a series of articles detailing various facets of Google Analytics that might have gone unnoticed, starting today with filters. What are filters? I’m glad you asked!

Filters allow you to curate the data you get in Google Analytics. Sure, you can just get all the data in one go, but what if you don’t want to see traffic from your own office or that SEO agency you hired? You can then, by using filters, get a more precise look at your data without unwanted flotsam and jetsam getting in your way. In this article, we’ll talk about some common filters you should use in Google Analytics, but first, we need to talk about views.

Let’s Talk About Views

If you’re unsure what a view is, let’s hit that first. Google Analytics goes like this:

Account -> Property -> View

A view is a specific way to look at the URL in a property, and a property can have up to twenty-five views. Why would one need multiple views? It allows you to see all sorts of data, and play with that data without causing problems elsewhere. This is also because once you apply to a filter to a view, it can’t be undone. So there are definitely solid reasons to have multiple views, especially if you want multiple ways to look at your data. Such views could include:

Raw View

This is, simply put, the raw, unfiltered, unedited data, ready to show you one unending torrent of unaltered information. This is your raw view, which has no filters, no alterations, nothing. This is a good view for a variety of reasons, such as data diagnoses and the like, so one should always have this view set up and unaltered.

Filtered Views – There Can Be Many

Now we come to the big deal, filtered views. You can have a ton of these, but some popular examples of filtered views could include things like:

  1. Direct View – Only shows direct, non-referral traffic. This would be set up by including only “direct” as a Campaign Source.
  2. Mobile View – Only shows traffic from mobile devices. This would be set up by including only “mobile” as a Device Category.
  3. Organic View – Only shows traffic from organic search engines. This would be set up by including only “organic” as a Campaign Medium.

These are just a few of the examples you could set up in order to better segregate your data into more easily-digestible chunks. In fact, we might do a separate article just on views since they’re so awesome. But it’s time to get into the main reason we’re here today, starting with...

Collecting The Right Data

We’re going to look at filters in two segments, the first being collecting the right data. While your unfiltered/raw data view gives you everything, you may not want to see the data with bots, or with shadow referrals or whatever else might bloat or distort the view and history of your data. Therefore, knowing which data to collect in order to sculpt your views just so is a great idea, as this gives a much more honest view of your traffic. These filters can be used in multiple views if you choose, that’s up to you, but these filters are very popular, useful, and just all around awesome, so let’s look at some of the most popular, shall we?

First off, if you’re not aware, filters can be found by going to the admin of your property, then view, then filters. Filters are specific to a view.

Setting Up External IPs, Both Excluding & Including

The external IP filter can go both ways. Say you want to have a view that filters out your internal office traffic, or another view that includes visits from your marketing agency. This is what you would use to make that magic happen. The way to do this is fairly simple. Set up a new filter and name it whatever you want, then select Custom Filter type. Here you select either Include or Exclude, depending on which you want, then change the Filter Field to IP Address, and in the Filter Pattern, enter the address you want. Boom, done.

Excluding Bots

This is a handy filter if you want to exclude search engine spiders and other various bots, and isn’t tough to set up. Set a Custom Filter type, set it to Exclude, then set the Filter Field to ISP Organization. You then enter this into the Filter Pattern field:

^(microsoft corp(oration)?|inktomi corporation|yahoo! inc\.|google inc\.|stumbleupon inc\.)$|gomez

Exactly like that. That should then filter bots out of your chosen view, hopefully forever unless they change something!

Excluding Or Including Subdirectories

This one is an easy one to set up, as it comes with a pre-defined filter. When creating a new filter, select Include Only or Exclude – depending on what you need for the view – then in the next box, select “traffic to the subdirectories,” with the expression “that begin with” and put your subdirectory (and only the subdirectory, not the whole URL) – i.e. /blog/ – in there.

Excluding Or Including Subdomains

This one is a little bit trickier. Let’s say your blog is on a subdomain rather than a subdirectory, as in the last example. Using your domain (for this example, we’ll use “example.com”), you want to make a Custom Filter and Include or Exclude as needed per view. You then want to enter something like this in the Filter Pattern:

^blog\.example\.com$

This then filters in or out – depending on how you’ve set it up – traffic from the blog’s subdirectory. This is great for a view in which you only want blog traffic or, on the flip side, one wherein you want no blog traffic at all.

Excluding Or Including Direct Traffic Using The Hostname

This filter is really important. If you’re including it, you’re doing so because you want to be sure the traffic you see is coming to your domain specifically. Why might you need this? Because someone could hijack your Analytics code and put it on another domain, giving you false readings, for example. In this case, you’ll make a Custom Filter, set it to Include or Exclude, depending on what you want, set the Filter Field to Hostname, and then, keeping with the example of example.com we’ve been using, add this to the Filter Pattern:

^(www\.)?example\.com$

That should set that filter in that view to only use traffic from that domain, or exclude it if you’re trying to see traffic which could be coming from other domains. This could be useful for a diagnostic view.

Including Specific Countries

Say you want a filter that shows only traffic from your home country, in our case, the United States. Thankfully, Analytics allows you to create a filter that allows you to do just that. This, again, is a Custom Filter, so once you name it, you select Include, set your Filter Field to Country, and then, in our example, set the Filter Pattern to United States.

However, say you want to filter in an entire region! Analytics lets you do that too. To use Google’s own example, say you want to filter the countries of APLA (Asia Pacific & Latin America), which include Argentina, Australia, Taiwan, and many others. In the Filter Pattern, you’d enter:

Argentina|Australia|Brazil|China|Hong Kong|India|Indonesia|Japan|Mexico|New Zealand|South Korea|Taiwan

Boom, done. Pretty great, huh?

Mobile-Only Filter

This one is, thankfully, easy to set up! Once you name your filter, set it to Include, then set the Filter Field to Device Category, then Mobile, and you’re done. This is good if you want a view that only shows mobile traffic, which is becoming more and more important.

As you can see, there are many ways to have Analytics filter your data so you collect exactly what you need, and these are just a few of the examples of the filters you can make. Speaking of, here’s a few more!

Making Your Data Consistent

We’ll now look at a few filters that make your data more consistent by, for example, filtering duplicates based on case, which happens all the time. The problem of case has been an issue with Google Analytics for a while, and these filters work to make these important pieces of data consistent by making them one case. Let’s take a look.

Lowercasing Campaign Attributes, Hostnames, Search Request, URI, & More

One of the biggest problems in data consistency with Google Analytics is case. A lot of times, if a campaign attribute or a hostname are reported using upper and lower case, those will appear as separate. For example, if someone comes to example.com and Example.com, you’ll see these separately. Using this filter makes all of these instances consistent by lowercasing everything, and these can be used on all sorts of things, like campaign names, search terms, URis, and more!

Setting up this one is pretty simple. Once you give it a name, set the Filter Type to Custom, select the Lowercase radio button, choose the Filter Field you want to lowercase, and you’re done!

Adding A Trailing Slash

For a lot of websites, you can visit a page with or without a trailing slash, and like the case-based example above, Analytics would show both as separate pieces of data. This filter is an Advanced filter, so it takes a bit more tweaking, but it’s worth it. First, after naming the filter, you select Custom, and then scroll down to the Advanced radio button and select it. You’ll see a bunch of fields we’ve not gone into before. Again, this is the Advanced stuff!

The first field will be entitled Field A -> Extract A, set that to Request URi and enter:

^(/[a-zA-Z0-9/_\-]*[^/])$

into the field. Then move down to the Output To -> Constructor section, set that to also Request URi, and put the following in the field:

$A1/

That will then append a trailing slash to your URLs so you’ll always see one, consistent set of data. Neat, huh?

Conclusion

Overall, filters – when coupled with focused, specific views – can be immensely powerful in helping you cultivate and craft your data into useful portions, and allow you to do all sorts of things with your data. This article is just the first of many Google Analytics articles, as we focus on making the most of this amazing platform. Thanks for reading, and we hope you found it useful.

written by: Brian Rubin

Check Out Other Relevant Guides

Let’s Talk Shop! Learn how to grow your business from the Wpromote experts.

Thank You For Your Interest In Wpromote!

Your message has been received and you will be contacted by one of our marketing specialists shortly. If you have any other questions, please do not hesitate to contact us by calling 310.421.4844 or by emailing sales@wpromote.com. We look forward to speaking with you shortly.

Sincerely,

The Wpromote Team

Get Educated! Recieve Wpro U Updates, Case Studies & More

Thanks for signing up to be a Wpromote Insider.
You’ll be the first to get the scoop on our latest services, promotions and industry news.


Recent Posts
Community Banks Get Social
Girl Vs. Internet – Schema
CONNECT
  • Los Angeles HQ: 310.421.4844
  • Chicago: 312.690.7112
  • San Francisco: 415.423.1535
  • Melville: 646.807.4074
  • Dallas: 214.696.9600
  • Houston: 281.974.5569
  • Denver: 720.583.9064
  • NYC: 310.321.4566