AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

Analytics
1.7K members online now
1.7K members online now
Ask questions about filter set-up and issues with using filters in Google Analytics reports
 
Guide Me
star_border
Reply

What is syntax for filtering multiple IP addresses?

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

What punctuation needs to go between IP addresses when I want to exclude multiple ones? I tried comma and I tried the pipe, but I continue to get Invalid IP Address error message when I put more than one into the form field.  Do I need to create a filter for each one?

2 Expert replyverified_user

Re: What is syntax for filtering multiple IP addresses?

Participant ✭ ✭ ☆
# 2
Participant ✭ ✭ ☆
You have to use the pipe | but it only works with custom filter.
In custom filter you can use a regular expression. And you have to be careful with regular expression.
For example if you want to exclude specific addresses always use ^ at the beginning and $ at the and of each address.

Below is an example:

^78\.8\.107\.10$|^79\.3\.27\.13$

if you only place this:

78.8.107.10|79.3.27.13

you can accidentally exclude many other addresses

like 178.8.107.10, 78.8.107.101, 179.3.27.13, 79.3.27.130 and so on.

Re: What is syntax for filtering multiple IP addresses?

Top Contributor
# 3
Top Contributor
Hi Angela F,

Can you provide what you have tried so far so that we can see what went wrong?

Typically you would use regex syntax. For example, if you want to filter 1.2.3.4 and 6, and also 2.3.4.5, 6, and 7, then you would write:

(1\.2\.3\.(4|6))|(2\.3\.4\.(5|6|7))

So the key is to get the regex correct.
Nicky Yuen, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here.
Find me on: Google+ | LinkedIn

What is syntax for filtering multiple IP addresses?

Mic
Visitor ✭ ✭ ✭
# 4
Mic
Visitor ✭ ✭ ✭

Hello,

 

I'm just coming back to this after I've found a nice *simple* tool to complete this for you.

 

ipaddressregex.com is what I use almost on a daily basis to filter my IP Addresses before I start work on my clients' website.

 

So to filter multiple IP Address through this tool, just add that vertical line character | in between the IP Addresses, and you should be good to go!

Please note too that you don't need those beginning and ending ^...$ characters, just the escaped periods \. and the vertical line |.

What is syntax for filtering multiple IP addresses?

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭

It looks like that tool stopped working :-/

 

What is syntax for filtering multiple IP addresses?

Top Contributor
# 6
Top Contributor

Hi :-)

A pipe character should work. Together with a custom exclude filter.
If you need to block ranges, then the following tool is useful

http://www.analyticsmarket.com/freetools/ipregex

 

You can also use multiple exclude filters.

Bronwyn Vourtis, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here

What is syntax for filtering multiple IP addresses?

Mic
Visitor ✭ ✭ ✭
# 7
Mic
Visitor ✭ ✭ ✭

@Tomasz B — Please try again it seems to be up for me? Probably just one of those times? 🤨

https://ipaddressregex.com/