How to filter an IP address range in Google Analytics

An essential part of using Google Analytics is to filter out traffic that skews your data. There are several types of traffic you may want to filter. The most obvious one is your own. This includes from your home, your office, and anywhere else you hit your site. It may also include your co-workers, unless one of your target audiences is your co-workers.

Filtering a single IP address is easy and takes just a matter of minutes to set up, if that. However filtering a range of IP addresses may be a bit more challenging, but is definitely doable.

1. To begin, log in to Google Analytics at

2. Click Admin at the top right of the page.

Google Analytics admin

3. Select the account for which you want to create the filter.

Google Analytics account

4. Click the Filters tab.

Google Analytics Filter

5. Click + New Filter.

Google Analytics Filter new

6. Enter a name for the filter. If you’re adding several filters that relate to each other, such as your home IP address and work IP address, get the filters a name that distinguishes them.

Filter name

7. Select Predefined filter to select from the predefined filter types. From there your filter can exclude or include only certain traffic based on ISP, IP, requested subdirectories, or requested hostname. If you’d like to make a more advanced filter, such as to filter a range of IP addresses, skip this step.

Google Analytics Filter IP address

8. To make an advanced filter, such as to filter an IP address range, select Custom filter.

Custom filter

9. Select Visitor IP Address in Filter Field.

Google Analytics filter IP address range

10. In Filter Pattern enter the IP address as a regular expression. Regular expressions are special characters that match the data and perform an action when a match is achieved.

  • If the single IP address is, then enter

Google Analytics IP address range filter

  • If the range of IP addresses is from to Enter 3.12.71.[1-9]
  • Here’s an even more complex example. You may need to brush up on your regular expression skills to accomplish this. If the IP addresses range is and, then enter ^176.168.1.([1-9]|1[0-9]|2[0-5])$|^10.0.0.([1-9]|1[0-4])$

Range of IP addresses

11. From the Available profiles list, select the profiles to which you want to apply the filter, then click Add, and lastly Save changes.

Google Analytics Filter profile

Congratulations! You’re now filter an IP address range. One way to test your 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 your Google Analytics account.

4 responses to “How to filter an IP address range in Google Analytics

  1. Just coming back to this, as I found a nice ‘n’ shiny tool to accomplish IP Address filtering well. will easily add those . front-slash dots for you.
    I use this on a daily basis as a best practice for client work (so I make use of Google’s Demo Account example of Test View), and if I want to include/exclude multiple IP Addresses, I just add the vertical pipe character | in between escaped IP Addresses.

Comments are closed.