Advanced Filters for Google Analytics

What are Google Analytics filters? Differences between view filters and segments.

Usually in Google Analytics, we refer to filters when we want to segment our data into smaller, targeted groups which will inform our goals. Filters can be used to include or exclude specific subsets of traffic, unwanted data – (bot traffic for example) or to tidy up pieces of our information, such as replacing the slash on our URL addresses.

Is important to note that Google Analytics allows you to use filters at View level or at the Summary Table level. The View filters have a permanent effect on the data that is going to be collected in your used view. Therefore, it is imperative to allow only the users which know what are they doing to setup View filters.

By comparison, Table views can be used by everyone to slice through your Google Analytics data because doesn’t affect any data collection.  As Table views, GA offers the Segmentation feature which is really handy, especially if you are sharing your reports with other parties from your agency, company or consultancy agency.

The main differences between Segments and View Filters are that the Segments don’t affect your future data and can be applied by anybody, while the View Filters can skew your GA data if are not used wisely and you need level access to be able to setup one.

How can you create a new Google Analytics filter?

Now that we covered the main differences between View filters and Segments, let’s focus on how we can create a View filter. Actually, a View Filter can be created at either Account or View level. The best practice is to create your filters at Account level and to assign them on your desired View(s).

To manage or to edit all your filters, you need to navigate to Admin tab and under Account select All Filters. (highlighted in blue). Also, if you want to have a filter only at a View level  (for example you are using a custom dimension or metric) you can set it up using the Filters tab under View Column. (highlighted in red)

Admin Dashboard for Google Analytics

GA filter types

1. Predefined Filters

As with any other tool, there are some predefined features which we can use in our data manipulation or segmentation. It is the same case here. Google Analytics has a series of predefined filters that are easy to set up and no specific knowledge is required to take advantage of them.

These Predefined Filters are setup using a 3 level set of definitions as follows:

  • Select filter type – Exclude or Include only
Predefined Filters - Select filter type
  • Select source or destination – traffic from the ISP domain, traffic from the IP addresses, traffic to the subdirectories, traffic to the hostname
Predefined Filters - Select source or destiantion
  • Select expression – that are equal to, that begin with, that end with, that contain
Predefined Filters - Select expression

Now that we have acknowledged our predefined filters, let’s have a look into some practical examples.  One of our most used predefined filters is when we want to exclude any of our internal traffic because we don’t want to “bloat” our direct traffic.

IP addresses filter

Let’s assume our IP address is 203.58.191.214. Our Exclude Internal Traffic filter  would be setup as follows:

Excluding Internal Traffic with IP address filter

Hostname filter

Another common filter which we often use for our clients is the hostname filter. Let’s say for example, that we have a client – Example Ltd, who wants to understand the performance of one of their domains and they need a separate view for it.

After we created a new view in their Google Analytics account, we need to setup a hostname filter at View level so we can make sure our data doesn’t include anything else except that domain’s traffic. (Assumption: Example1.com is our analyzed domain)

Hostname Filter

Some important notes:

  • Use only one include filter of the same type.  For example, one include filter on medium=email and another include filter on medium=organic will result in a conflict and it is possible that no data will be collected. So, the solution would be to use a RegEx: email|organic to create a custom filter.
  • Using different filters for different purposes needs to be managed properly, and usually the filters order will influence what data is shown. So, as guideline, when you setup a new filter keep in mind that you probably need to setup a new view also.
  • If your implementation involves only 1 domain, setting up this type of filter would help with spam traffic and also can be seen as a precaution in case others are hijacking your GA tracking code and placing it elsewhere.

2. Custom Filters

Custom filters in Google Analytics are considered to be advanced filters because some knowledge is required to understand how the available categories of filter are working and what the best way to use them is without skewing your data. Remember, the View filters are affecting your GA data from the time they’re implemented onwards.

The custom filters in Google Analytics are divided into 4 groups:

  1. Exclude/Include
  2. Lowercase/Uppercase
  3. Search and Replace
  4. Advanced

a.) The main categories with the Include/Exclude option are:  content and traffic, campaign or adgroup, ecommerce, audience/users, location, event, application, mobile device, social and other. Basically, your possibilities are unlimited.

b.) Due to the way Google Analytics reads the uppercase and lowercase some data issues can occur. For example, if you have a campaign tagged as utm_medium=Facebook and other one as utm_medium=facebook, GA will report on those as two separate entities. To resolve this issue a Lowercase/Uppercase filter will help.

Lowercase Filter

We prefer using lowercase filters instead of uppercase ones and one of the reasons is that Google by default is using lowercase format, in our case, for medium. We would recommend using lowercase filters for: Request URI, Campaign Medium, Campaign Source, Campaign Name, Campaign Term, Campaign Content.

c.) Search and Replace filters are really handy when you want to correct a utm parameter, for example or if you have a slash on your URL end and you want it to be reported as a non-slash.

Let’s take an example: we have some blog articles which were created as a mini-series for the same topic: blog/knowhow/seo/tip1, blog/knowhow/seo/tip2, blog/knowhow/seo/tip3. We want to see these pages as one in our view in Google Analytics, therefore our filter will look like this:

Search and Replace Filter

The dot-asterisk (.*) means, in regex, consider any random combination of zero or more characters;  in our case, any characters behind /knowhow/seo/. Search and replace filters can be applied to all areas except location based filters.

d.) Advanced filters are really useful in so many scenarios, but to use them you need to understand how regex works. Please use this opportunity to learn more about regex and you can start by using our Beginner’s Guide into Regex for Google Analytics/GTM.

One of our most used advanced filters is to instruct GA into showing the hostname along with the request URI. By default, Google Analytics, doesn’t do this in the page report, so with the filter help we can see the full address, especially if the same view is collecting data from two different domains.

Advanced filter - Show hostname & URI combined

Conclusion

Using filters can bring a lot of clarity and accuracy to your Google Analytics reports and there are virtually unlimited possibilities on how and when to use them. Now, let’s review some of the most important points from this ultimate guide for GA advanced filters:

  1. Always keep an unfiltered data view;
  2. View filters are future based (affect the data from the time of implementation onwards), cannot be undone and should be used as a long term segmentation strategy;
  3. Segments are really handy for ad hoc analysis, and don’t affect your stored data;
  4. Always use your Testing View as a first step for filters before moving them to the main view; this way you will be able to adjust any configuration and you are sure that no data was deleted from your Main View;
  5. Filters are useful for any type of scenario on any website (e-commerce, lead generation, blogs, etc.)
  6. Sometimes, view filters can take up to 2 hours to show any effect on your data.
  7. Use view filters wisely and keep in mind that more advanced ones require some regex knowledge.
Like what you see? Lets talk. Get In Touch