How to filter a range of IP addresses in Google Analytics
Google Analytics is used to track how a visitors interact with our website. When our Google Analytics report contains data about internal and external traffic on our website, the statistics will be incorrect, as it is adversely affected by our own visits (internal traffic). This includes from our home, our office, and anywhere else we hit our website. It may also include our co-workers, or any member of our team. But we can stop Analytics from tracking our internal traffic by filtering our IP address.
Filtering internal traffic is even more important in early stages of our websites’ life. While our website has little traffic and we spend more time reviewing each of our web pages or performing unfinished development tasks, our activity is a greater per cent compared to the total activity. Not only changes noticeably the number of visits per session, but also the number of page views per visit, bounce rate and average time spent per user among many other parameters.
There are several methods to filter out internal traffic in Google Analytics. In this guide I’ll show how to use Google Analytics native feature - Filters for filter a range of IP addresses. For filtering a single IP address, please read another my article here.
First, log in to your Google Analytics account.
Select the website for which you want to create the filter. It can be selected from the list in the upper left corner of the page.
Adminbutton (image of the cog) at the bottom left corner of the page.
- Click on the
- Click the
+ New Filterbutton.
- Let’s enter a name for the filter in the field “Filter Name”. I entered “Exclude internal traffic”, but if you’re adding several filters that relate to each other, such as your home IP address and work IP address, then get the filters a name that distinguishes them.
Customfrom the predefined “Filter Type”.
Excludefrom the list bellow.
IP Addressfrom the “Filter Field” dropdown list.
In the field “Filter Pattern” enter the regular expression that matches your range of IP addresses. For example:
^74\.125\.19\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))$. The easiest way to create the regular expression for the range of IP addresses is by using the IP Range Regular Expression Builder from Analytics Market.
That’s it, we’re done. We’re now filter the internal traffic. So simple isn’t it?
One way to test our filter is to browse to a private page that no one else would have access to, and see if any traffic to that page gets recorded in our Google Analytics report.
If this article has helped you then please leave a comment
Thanks for reading!
Arthur is a designer and full stack software engineer. He is the founder of Space X-Chimp and the blog My Cyber Universe. His personal website can be found at arthurgareginyan.com.