1
votes

I’m currently trying to filer internal use of a site in Google Analytics. There are 10 different IP ranges to match. As far as I know, you can’t add multiple “include” filters to one single profile as Google Analytics firstly will return a true match if all of the include filter return true. To solve this, you can use the pipe (|) and concatenate several ranges into one filter. Anyhow, the limit of 254 characters for a single filter doesn’t enable this option for me.

According to the documentation, exclude filters works a bit different. You can have several exclude filters for a single profile. So, I came up with the following solution using negative lookahead. Applying and exclusion filter with negative lookahead would actually give a match for the given range.

IP Range: 212.43.120.30 to 212.43.120.40

RegEx: ^(?!^212.43.120.(3[0-9]|40)$).*$

Filter type: exclude

The above RegEx tells that any IP that doesn’t give a match within the range would be excluded. So, we turned an exclusion filter into a include one. And as Google Analytics accepts several exclusion filters for a give profile, you could actually add several of ranges by different exlude filters.

Then, I noticed that Google Analytics doesn’t seems to accept lookahead at all. The thing is, it’s mentioned here and on other sites, but I can’t find it documented by Google. Does someone have a link where Google explains this, that verifyes if lookahead is allowed or not? Does someone have a solution to add several include filter for a single profile?

1

1 Answers

0
votes

Have you tried this ?

In "personalized filter" choose "include" and "visitor ip" with 212\.43\.120\.[30-40]