Tag Archives: Analytics

Filtering a range of IP addresses from Google Analytics

In order to exclude false site visits from my Google Analytics, I have implemented a filter that excludes everything from an IP address range.

First, I check my IP address.  I used my “WAN” ip address since that’s what Google sees when I visit my site.  I don’t have a static IP so this will likely change over time.

Screenshot 2014-10-27 17.13.01

Now that I know my current IPaddress… what is the IP allocation range for ViaSat? Lets look at ARIN (American Registry for Internet Numbers), for the answer…

Screenshot 2014-10-27 17.46.29

This gives us a nice range of 131,072(2x256x256) IPv4 addresses.   I decided to just filter out anyone who is coming in over ViaSat’s ip range.  Sorry ViaSat visitors but your only being filtered from Analytics, so this isn’t such a big deal.

Log in to your Google Analytics account, then click on Admin.  Click “All Filters” then click “New Filter.”   Give it a name, then select “Custom” filter type.

Select “IP Address” in the Filter Field if it’s not already.  Then in the “filter Pattern” text box, you put a “regular expression” that suits the range you want.  In this case I am doing

^184\.(2[0-1])\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))$

This should exclude the range from 184.20.0.0 to 184.21.255.255

I used the free IP address range regex generator from Analyticsmarket.com

Hope this helps someone.