{"id":4393,"date":"2020-06-07T11:03:57","date_gmt":"2020-06-07T08:03:57","guid":{"rendered":"https:\/\/trackingchef.com\/?p=4393"},"modified":"2020-12-14T16:56:24","modified_gmt":"2020-12-14T13:56:24","slug":"filtering-multiple-ips-in-google-analytics","status":"publish","type":"post","link":"https:\/\/trackingchef.com\/google-analytics\/filtering-multiple-ips-in-google-analytics\/","title":{"rendered":"Filtering multiple IPs in Google Analytics"},"content":{"rendered":"\n

Filtering an IP in Google Analytics is pretty simple (see post<\/a>). But in many cases, a company will have multiple IPs to exclude, e.g. multiple office locations.<\/p>\n\n\n\n

In this post I’ll cover several ways to implement such filters.<\/p>\n\n\n\n

Multiple filters<\/h2>\n\n\n\n

One way of applying such filters is by adding a single filter for each IP. Following the instructions on my previous post<\/a>, you can easily set up an IP filter and add as many as you like for each office location.<\/p>\n\n\n\n

\"\"
Applying multiple filters to exclude multiple locations<\/figcaption><\/figure>\n\n\n\n

Pro tip:<\/strong>
Google Analytics filters apply in the order in which they are set, so the final input will have passed through all filter.<\/p><\/blockquote>\n\n\n\n

Combined filters<\/h2>\n\n\n\n

Another option, when wanting to exclude multiple IP addresses in one shot, is creating one filter that captures multiple addresses.<\/p>\n\n\n\n

To achieve that, you need to create a filter of the type ‘Custom’. Select Exclude and use the Filter Field ‘IP Address’.<\/p>\n\n\n\n

The Filter Pattern uses regular expression<\/a> matching, so you can input multiple IP addresses separated by a pipeline | to exclude multiple IPs using one filter.<\/p>\n\n\n\n

e.g. 123.123.123.123|134.134.134.134<\/p><\/blockquote>\n\n\n\n

\"\"
Excluding multiple IPs with a single filter<\/figcaption><\/figure>\n\n\n\n

C-Class filter<\/h2>\n\n\n\n

Following the solution above, in some cases the offices might use a range of IP addresses and not only one single address. This is very common for larger offices and campuses.<\/p>\n\n\n\n

In this case, you can use the regular expression matching to exclude an entire range of IPs.<\/p>\n\n\n\n

The most common case is excluding an IP C-Class. This is the entire range of IPs indicated by the final digits in the IP address. For example, 234 in the address below.<\/p>\n\n\n\n

123.123.123.234<\/strong><\/em><\/p><\/blockquote>\n\n\n\n

To exclude the entire range, we can create a filter to match 123.123.123.*<\/em><\/p>\n\n\n\n

\"\"
Filtering out an IP C-Class range <\/figcaption><\/figure>\n\n\n\n

This will exclude all traffic that matches this pattern, e.g. 123.123.123.222<\/strong><\/p>\n\n\n\n

Pro tip:
<\/strong> This is a simplified version of the regular expression syntax that could include edge cases. The “full” syntax should actually be 123\\.123\\.123\\..* <\/em><\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"

Filtering an IP in Google Analytics is pretty simple (see post). But in many cases, a company will have multiple IPs to exclude, e.g. multiple office locations. In this post I’ll cover several ways to implement such filters. Multiple filters One way of applying such filters is by adding a single filter for each IP. […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"_links":{"self":[{"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/posts\/4393"}],"collection":[{"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/comments?post=4393"}],"version-history":[{"count":4,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/posts\/4393\/revisions"}],"predecessor-version":[{"id":4827,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/posts\/4393\/revisions\/4827"}],"wp:attachment":[{"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/media?parent=4393"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/categories?post=4393"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/tags?post=4393"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}