1

I am trying to filter out "my own" aka "internal" traffic as a new View in Google Analytics.

I was able to filter out my own traffic by excluding my IPv6 address, but not by excluding by public IPv4 address or block. I can see a successful and unsuccessful filter by watching the real-time reporting on content (urls).

How does Google Analytics go about registering the IP address of visitors, exactly? Does it prioritize IPv6 over IPv4, or, does it take both?

Thanks

  • AFAIK, GA looks at the public IP address and is able to take either format, so you shouldn't be having any problems filtering by either IPv4 or IPv6. – nyuen Jul 21 '15 at 15:33
1

Scenario 1: IPv4 only

Simple.

Scenario 2: IPv6 only

Simple.

Scenario 3: IPv4 + IPv6 dual stack client AND IPv4 server

  • Client will fetch resources from server using IPv4.
  • Client will hit Google Analytics using IPv6.

IPv6 Filtering Conclusion

Google Analytics will always abbreviate/shorthand the IPv6 address, so the corresponding filter must also target the abbreviate/shorthand expression of an IPv6 address or block. Note: this is not an official notice, it's just a conclusion based on experimentally trying different representations of an IPv6 exclude filter.

  • The reason my initial attempts at writing a filter failed was because my filter regex was not fully in abbreviate/shorthand form.
  • When dual-stack is a possibility, filter for both IPv4 and IPv6 blocks.

Sample solution

I just had an experience where I had to figure out how to filter out an IPv6 block, excluding a /56 range. The solution was in fact perfectly straightforward string matching regex.

  • Solution -- ^1234:abcd:5:6..:.*$
  • A little more clear for human eyes -- ^1234[:]abcd[:]5[:]6..[:].*$

To figure that regex out, I just used a calculator like so -- https://www.ultratools.com/tools/ipv6CIDRToRangeResult?ipAddress=1234%3Aabcd%3A5%3A600%3A%3A%2F56

Note the two period "." symbols after the 6, used to cover the 00-ff range; followed by a wildcard to match everything else.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.