One of the little tasks I’ve had in my To Do list for today was to figure out how to exclude a collection of IP addresses from counting as traffic in some client Google Analytics accounts.
Why would I want to do that you might ask? Well, if you want to know how well your website is doing at attracting new customers and visitors, you’re probably not (or shouldn’t be) interested in how many of your own employees are visiting the website.
So, we want to exclude an IP address range from our site traffic numbers, which can be done by setting up a custom filter in Google Analytics.
I’ll show you how to do this kind of backwards so it will be easier to setup when you’re ready.
First we want to grab the list of IP addresses that we want to exclude. Google has a little tool that makes this really easy. Since the result is a regex string, anything to make it easier for me is appreciated. I still haven’t figured out regex language yet.
Next we want to place the regular expression filter we just created into a custom filter in Google.
This is perhaps the most challenging part of the whole she-bang, getting to the Custom Filters section in Google.
- Click on the “Analytics Settings” link that’s found right under the Google Analytics logo. Once you click on that, click on the account that has the domain you want to create a filter. Once that page loads, there’s a link in the bottom-right-hand corner for “Filter Manager”. Click that! Once that page pops up on the right-hand side of the gray bar should be a link titled “+ Add Filter”. Click that and you should see the image above.
- Give your filter a name, select “Custom Filter”, select “Exclude”, select Filter Field by “Visitor IP Address”, paste the regular expression we created at the beginning as the “Filter Pattern”.
- Select which website profiles you want the rule to apply. Unless the client has multiple domains, I doubt you’re going to be choosing more than one here. However, you could create an IP exclusion for your own IP address and make sure that your own traffic is excluded from all of the websites you manage.
- Click “Save Changes”
VOILA! You’re done.
Hopefully that helps someone.
UPDATE:
After we played around with this a bit more, we realized it wasn’t immediately apparent that the filter was or wasn’t getting applied. I then found this little bit of information from Google:
If you’d like to apply filters to your data while keeping your “raw” data intact, you can create a duplicate profile in your account. To do so, add a new profile using the Add profile for an existing domain option. When this option is selected, the tracking code generated for the new profile will be identical to the tracking code for the original profile, and data will be imported simultaneously into both. You won’t need to change the tracking code on your site, and any filters applied to the first profile will not affect data in the second.
Setting up multiple profiles seems like the best option, but the idea of having an overlay view available within the analytics seems like a handy addition. To me they should handle it like any of their other custom segments or filters within the data and user-interface.