Clean up your Google Analytics data with these 5 filters

- April 7, 2011

Attention all Google Analytics users around the world: you don’t have to be an expert in regular expressions to use filters. Why? Because this post will help you, that’s why!

No long and drawn-out lead-in to the story this time – here are 5 filters that you can create for your Google Analytics profile(s) that will tidy up your data and make you a happier analyst.

1. Excluding your own traffic from reports
Why: Chances are that your own visits to your own web site aren’t racking up that many visits and page views. Nonetheless, you can still permanently remove your own traffic statistics from appearing in your Google Analytics profile(s).
How: First, grab your IP address from (or, ask an IT person). If you have administrative access to your account, click on your account’s name, then click on your web property’s name. Next, click on the filters sub-tab (within the profiles tab), click on “Add Filter“, and do the following:

Method: Create New Filter
Filter Name: Exclude my IP Address
Filter Type: Custom Filter >> Exclude
Filter Field: Visitor IP Address
Filter Pattern: ^192\.168\.25\.25$
Case Sensitive: No

Replace the IP address in the example above with your own IP address, but leave the ^, the $, and the three \ symbols (just replace the numbers). Click Save, and you’re done!

2. Lowercasing your hostnames
Why: A hostname is a domain that has sent you visitor data. In other words, a hostname is a URL where your Google Analytics tracking code is present and has at least sent you 1 visit during the selected date-range that you’re looking at. If you ever toggle your report dimension by hostname, or switch the viewing table to show hostnames, you could see mixed cases (upper and lower), which leads to many different variations of your same domain name appearing. That also means you need to work on your SEO re-directs – but that’s something for another time.
How: Go through the same steps as you did in the last filter to get to the filter creation screen. Once there, do this:

Method: Create New Filter
Filter Name: Lowercase Hostnames
Filter Type: Custom Filter >> Lowercase
Filter Field: Hostname

Click Save, and you’re done! You can also create additional lowercase filters to do the same thing to other pieces of data that may look unsightly (one of them might be the Request URI filter field, which represents everything after the .com part of your URL).

3. Search for long, bulky page name; Replace with short, clean page name.
Why: Page names can get long and bulky. There’s probably an important page in your top ten that’s just an eye-sore. How about we shorten it and clean it up some?
How: Follow these filter creation steps – but remember to change the page names to your own, as the following is just an example:

Method: Create New Filter
Filter Name: Search & Replace: Long page with “/john.php”
Filter Type: Custom Filter >> Search and Replace
Filter Field: Request URI
Search String: /your-very-long-and-bulky-page.php?id=1234567
Replace String: /john.php
Case Sensitive: No

4. Add the visitor’s browser to the visitor’s operating system
Why: Why not? Google Analytics lets you create some powerful, advanced filters that let you do something cool (and efficient) like adding the visitor’s browser to the operating system that they’re using. This way, you can see a visitor’s browser along side a visitor’s operating system, without having to apply a secondary dimension (saving your secondary dimension option for something else).
How: Here’s how you do it:

Method: Create New Filter
Filter Name: Operating System + Browser Platform
Filter Type: Custom Filter >> Advanced
Field A -> Extract A: Visitor Operating System Platform -> (.*)
Field B -> Extract B: Visitor Browser Program -> (.*)
Output To -> Constructor: Visitor Operating System Platform -> $A1 – $B1
Field A Required: Yes
Field B Required: No
Override Output Field: Yes
Case Sensitive: No

For Field A and Field B, choose the filter field as described, and then in the blank form field, type in (.*) as shown.

5. Include your domain (and, ONLY your domain!)
Why: Unfortunately, server caching and having your tracking code outright stolen and placed on someone else’s web site is something that we sometimes have to deal with. So, from time to time, you must write a filter that will prohibit the collection of data from every domain except for your own web site.
How: Create your include filter like this:

Method: Create New Filter
Filter Name: Include my domain
Filter Type: Custom Filter >> Include
Filter Field: Hostname
Filter Pattern: mywebsite\.com$
Case Sensitive: No

Click Save to stop the nefarious ones from sending you irrelevant data!

We could write about filters until the next Presidential election, because there is just so much on the topic, and, so many different things that you can do with filters. Even though you can copy the steps outlined in the above 5 filters directly, I still urge you to use caution. Filters are sensitive, temperamental, and must be precise, to say the very least. A poorly-created filter can cause permanent damage, so tread lightly.

What about you? What filters do you like to use? What problems are you experiencing? We’d love to hear your thoughts below!

Comments are closed at this time.

© 2017 MoreVisibility. All rights reserved