Use Google Analytics Advanced Filters To Clean Up URLs


Google Analytics advanced filters allow you to tidy up your data and gain greater clarity. By making the data more friendly you will be able to identify actionable insights and optimise your website with greater ease.

How to Set Up a Google Analytics Advanced Filter

Google Analytics has several different options when you need to filter out data.

  • Predefined Filters – These are easier to set up but give you less control
  • Custom Filters – Allow for capitalisation of the characters and for simple process’ such as either removal or addition on text
  • Custom Advanced Filters – These allow for the most customisation and making multiple changes within the same filter

It is easier to manage Google Analytics advanced filters if you want to apply multiple changes to data at once and the additional benefit of greater control again works in their favor

So What Can You Use Google Analytics Advanced Filter For?

You can use Google Analytics filters to adjust any of the data that is sent to Google Analytics whether it is excluding traffic from certain IP addresses or whether it is filtering data to only show visits to certain areas of the site or adjusting names.

The following examples will demonstrate some of the key principles of Google Analytics advanced filters. You can set these up using text or regular expressions to define elements. You will need to define variable by enclosing using parenthesis() and then constructing the output.

Example 1 – Remove Parameter From the URL using GA Advanced Filters

The below advanced filter example demonstrates how easy it is to remove parts of a URL from the data that is displayed in Google Analytics.

Primarily this is useful when replacing parts of a URL, however, it can also be useful if you have long URLs that you want to shorten in Google Analytics.

This Google Analytics advanced filter works by:

  • Field A is set to look at the URL
  • Three field A variables are defined using parenthesis which are referred to as $A1, $A2 and $A3
  • $A2 defines the page /index.php (using the \ to make the . into a regular character
  • $A1 and $A3 use regular expressions to represent any text before and after the $A2 variable
  • The output field shows that only the variables $A1 and $A3 are returned (removing /index.php from URL’s)

Example 2 – Insert a Parameter into the URL using GA Advanced Filters

This is a good example of how you can insert additional data into the URL that is displaying in Google Analytics.

This is really useful when you want to add additional information and particularly when combined with the previous example. Combining these methods allows you to replace a non intuitive part of the URL with a name that is more easily understood (such as swapping a category code for the category name).

This Google Analytics advanced filter works by:

  • Field A is set to look at the URL
  • One Variable is defined in field A – $A1
  • $A1 looks for the page foo/bar at the start of the URL (defined by ^)
  • $A1 can be followed by any other pages (defined by .*)
  • In the output index.php is put at the start of the pages that begin with foo/bar

I hope this helps in your use of Google Analytics advanced filters. It shows the simpler ways they can be manipulated but demonstrates their ability. As they use Regular Expressions the options are limitless.

Please leave comments below and let me know if you would like me to post about in the future

Leave a Reply

%d bloggers like this: