BLOG

Filters in Google Analytics have quite a bit of power behind them, and because with great power comes great responsibility, they should always have strategic reasoning behind their use. We touched on this when talking about The House Model© previously. We also naturally, of course, have a free PDF download for you on filters in Google Analytics.

How do filters work in GA?

You add your UA-property code onto your website for Google Analytics to start collecting data and based on your configuration (aka your admin settings) it will process that data and pop it into a reporting view. 

Filters essentially tweak the data so you see what you want to see inside your reporting views, and remove things that you might not. Filters lurch into action between the configuration and processing stage. They take out the stuff you don’t want or include the bits you do. So, as you can imagine, they can be quite powerful. No one wants the grind in their coffee, or staff in the sessions, as that would be a terrible experience. 

Step 1 Collection Google uses a little bit of javascript, the proverbial cookie with your coffee, to collect data about your users and their behavior.

Step 2 Configuration Google takes a look at what you are after, and all the data it can get and pings it to the Google servers – accounting for all the toggles and things that you’ve been tinkering with in your admin settings.

Step 3 Filter This is a part of your configuration that Google pays particular attention to in settings.

Step 4 Processing Google processes the data, aggregates it, performs a bunch of calculations, and passes it on to reporting.

Step 5 Reporting Google passes the report to your desk for your attention – good times!

Examples of Filters 

Common examples for filters in Google Analytics are removing things like staff. If you have a static IP address and lots of staff all firing up your website every day, they will show up as users and sessions, which is going to mess up your data, big time! Google Analytics will calculate your conversion rates based on sessions to the website, if those sessions are your staff, you may be diluting your conversion rates.

Another example is to create filters to zoom in on users and sessions from a particular country. We use that here at The Coloring in Department, we have a view to show all of our data, and then we have views to show traffic just from the UK, just for the USA and just for Australia, etc. 

Aside from removing staff and looking at a country, it can be hard to know what kinds of filters to apply. Where do you start? 

What filters should you have in Google Analytics? 

Here at The Coloring in Department, we think a great place to start is by grouping a set of filters together that have common themes. We use 3 themes for our filters so that you can see the right people, the right content, and improve the reporting readability. 

With this in mind, let’s jump into these themes and some examples of the filters within them that you would want as a baseline foundation. We will also give a nod so to speak as to the type of filter you would need. However, we won’t get that down and gritty in the details for this particular blog post. 

Goes without saying, when you create any filters, do them in your TEST view 1st, check they work, then move them over to your Reporting views! 

Theme 1: See the right people 

I can not stress this enough, you want to see the right people in your data, you do not want to dilute those conversion rates and over-inflate your user and session counts. 

Filter: Exclude Staff 

Purpose: You don’t want staff showing up as visitors, because they are not your visitors! This filter works really well for big companies where you know the static IP address or range of IP addresses.

Example Filter Type:  Predefined: Exclude traffic from the IP address that equals. Or for those of you that have a range of IP addresses, you will need to use a Custom filter to exclude traffic from a Filter Field = IP Address and put in the filter pattern (you will need regex here). 

Filter: Exclude Dev Sites and Staging Areas 

Purpose: When you are working in your development or staging environments, sometimes, if you forget to put a filter in place to exclude this traffic, you can head into trouble – as you think you have visitors looking at product pages, or completing a checkout, but the money doesn’t end up in your pocket. 

By all means, set up a View for Development and Staging sites so you can see how it works and if the tracking is correct, just make sure you set up a filter to not include traffic from your development environments. 

Example Filter Type: Predefined, Include (or Exclude depending on the View) traffic, from the hostname, that is equal to the name of the domain. 

Filter: Only See a Particular Country/City 

Purpose:  If your business is working in different markets, you may want to create a view and add a filter to just see users from particular countries or cities. This is particularly handy as your view settings have the option to select a currency and timezone. So, you could have a filter for a view just for the USA and have the time-zone and currency to match. Easier to watch the dollars roll in.

Example Filter Type: Custom, include, a city that is equal to for example London 

Theme 2: See the right website content 

Once you have the right users and sessions being counted correctly in GA, you move on to getting the right type of content into your account. We are mostly talking here about getting your Behaviour reports (aka what do people do when they are on your website) tidy, so these filters can help you view your website content in a cleaner light.

Filter: Show Full Hostname 

Purpose:  If you have cross-domain tracking setup across a few domains/subdomains, this filter is an absolute MUST. Let’s say you are using cross-domain traffic across shop.website.com, website.com, and account.website.com. In your Behaviour > All Pages report, GA will show the URI (which is the bit after your domain).

This means that for this example, all three sites homepage will show up as / and all the pages will be /pagename etc. Adding this filter would show the FULL URL so you can see correctly what traffic is from shop.website.com etc 

Example Filter Type: Custom, Advanced filter, this is a tad more complicated as it uses Regex which has a habit of melting my face. But if you want to try it, you need to request to change the Field A > Extract A hostname (.*) and Field B > Extract B (.*)  and Output to > Constructor Request URL $A1$B1 end this filter by ticking on the box Field Aa Required, and Override Output Field. 

Filter:  Include Directory 

Purpose:  You can then build filters to just show traffic from a directory. For example, you have a blog and you just want to see what is going on there, you could add a filter to just show traffic from the blog. 

You could also do this if you have a site that is using multiple languages eg website.com/fr/ for French pages, website.com/es/ for Spanish pages, etc You can build a view with the settings set to that country, and then a filter to show traffic from the directories/blog that matches the country.

Example Filter Type: Custom, Include, Request URI and add the filter pattern for your directory, which may need some regex to work for example ^/(fr)/ 

Theme 3: Improve reporting readability 

This final example here, on filters, that you should have in your filter playbook is based on making the reports easier to read, and making sure you don’t fragment your data. Which is surprisingly easy to do. 

Filter:  Append a Trailing Slash 

Purpose:  Once upon a time, if you didn’t type or hadn’t clicked on a link that was exactly correct, it would say “page not found.” I’m talking about how you can type or link to website.com/blog/ and if someone used website.com/blog you still get to the same page.

Problem is, Google Analytics is case sensitive and will record the URL as a hit within a users session. So, you end up with content reports and you have fragmented your data. Having a filter to add a trailing slash across all your URLs means you have a tidy All Pages report and you don’t accidentally undervalue pages on your website. 

Example Filter Type: Custom, Advanced, and like our show full hostname filter, you are going to look for Field A > Extract A Request URI and use this Regex string  ^(/[a-zA-Z0-9/_\-]*[^/])$

Then look for Output to > Constructor Request URI $A1/ and again end this filter by ticking on the box Field Aa Required, and Override Output Field. 

Filter:  Rewrite Dimensions 

Purpose:  The final one for this theme is readability. Sometimes, the way our websites are built can make our job hard. Let’s say you have a contact form that comes into your website data as ‘ht_form_9785672-contact’ and maybe you have more than one of these… well wouldn’t it be nice to have a filter that would change this to something like “Sales Contact Form”, yeah, you guys have guessed it, there is a filter that can tidy that up for you! 

Example Filter Type: Custom, Search and Replace, and for this example, you could select Request URI and then tell GA what the search string you are looking for (your search) is, eg /ht_form_9785672-contact/ you may need Regex (another reason you do this in your test view to check it works). Last part of the filter you just add the name you want to replace the search string with, for example, ‘Sales Contact Form’ 

Quick Recap on Filters: 

  • Filters take about 24 hours to work on your account, so when you apply them to your test view, you should ideally check in a day later. I would like to have at least 7 days worth of data to look over and check before I call it either way. You may need more time to check how they are working, depending on what your normal traffic looks like. 
  • One filter input is the output of the next filter, so your filter order can make a big difference to your data. 
  • Filters are assigned to your View, but if you edit a filter at View level, it will impact any other View that has that filter added to it. This is because filters sit in a big bulk at the Account Level, and thinking about our House Model © anything you do to your roof is going to impact the floor and all windows associated with it.
  • Google Analytics is case sensitive, so even if you think “I don’t think I need any filters” that is probably not true, if you have, say, a few URLs that are a mix of lower case and upper case, they will show up in your reports as different pages, and therefore you have fragmented your data, not ideal. 

We have a whole module in our Online Google Analytics Course dedicated to Filters. If you want to learn more, head over here and sign up so you know when the course is live!