Google Analytics Filters

How To Guides

Must Have Google Analytics Filters

Google Analytics filters are a great way to define what data is included or excluded and how it appears in your reports. Here we have covered the most common ones that should meet the bulk, if not all, of your needs.

Ideally your Google Analytics will have a minimum of these three Views – untouched raw data, a main View that you use for regular reporting and a Test View that is your staging or production site only.

Important to know:

  • Google Analytics Filters permanently change the data going into your reports until they are removed or modified so this is why you need a completely unfiltered View as well.
  • They won’t change any historic data, only modify data going forwards
  • The order of the filters matters because Analytics goes through them in sequence so what data is left after filter 1 will then have filter 2 applied and so on.
  • They can take up to 24 hours to take effect

Where to create your filters
You set up your filters in the Admin section of Google Analytics. If you want a filter to apply to more than one View then choose the option under your Account column, however, if it only needs to apply to one then select that View and add it under the View column.

The filters we’re going to cover in this guide are:

  • Exclude internal traffic
  • Include a specific domain
  • Lowercase page URLs
  • Remove query strings from URLs
  • Lowercase campaign parameters
  • Combine all Facebook referrers
  • Lowercase site search terms
  • Append trailing slash to your URLs

Exclude Internal Traffic

Excluding your own organisation and any relevant third parties from ensures that the data in your main reporting view is only from potential or actual customers. If you have team using the website on behalf of customers you should create a View solely for this activity. The most common and reliable way to exclude internal traffic is through IP addresses. There are two ways to do this, either through a Predefined filter

Or a Custom filter.

If you had a range of IP addresses to add rather than a single one then the Custom option is the best one to use. To create a filter to include an IP address or addresses then follow these same steps but changing the Exclude option for Include.

Include A Specific Domain

This filter is particularly useful when creating a Test Only View and you only want to include traffic from your staging site.

You would also want to exclude any staging sites from your main reporting View, this would be the same as above but using the Exclude option instead.

Lowercase Page URLs

Sometimes pages viewed on a website can have various different uses of capitalisations and Google Analytics considers these to be separate URLs and separates them out in your reports, diluting your data. This filter standardises how all of these URLs are reported.

Choosing Request URI covers everything after the domain.

Remove Query Strings From URLs

Some marketing activities can end up with query strings being added to the end of URLs. Frustratingly Google Analytics considers them to be unique URLs giving you a long report and diluting the stats for those pages. This Custom filter removes these query strings so for example /?querystring123 and /?querystring456 will both show in your reports as /.

In Field A enter ^([^?]+)

In Output To > Constructor enter $A1

Lowercase Campaign Parameters

When marketing campaigns are tagged up it can be hard to make sure the naming is kept consistent 100% of the time, creating filters to lowercase the medium, source or campaign parameters means if capitalisation isn’t always the same when creating UTM parameters it won’t be separated out in the reports.

Choose from Campaign Medium, Campaign Source and Campaign Name accordingly.

Combine All Facebook Referrers

You may see in your acquisition reports that there are a number of different sources coming through for platforms such as Facebook. Often you just want to see how that platform as a whole is performing. This Custom filter will group them all together for you, change Facebook for other platforms as you want.

Lowercase Site Search Terms

If you have search functionality on your website then you know people can search for the same terms using a mixture of capitalisations. This makes it harder to identify the top searches as they will be split out in your reports. This filter will help make your reports much more useful.

Append Trailing Slash To Your URLs

Trailing slashes appear on the end of URLs splitting them out in the reports, for example /blog and /blog/. This custom filter will add a trailing slash to all URLs making them consistent throughout.

In Field A enter ^(/[a-zA-Z0-9/_\-]*[^/])$
In Output To > Constructor enter $A1/

Make sure this is the last filter in your list because it can impact filters below it if it isn’t.

To see how we can help with your Google Analytics set up take a look at our Troubleshooting solution.

You can find Google’s support guide to filters here