In your quest for the utmost data integrity, you’ve begun to filter out IP addresses. Filtering our IP addresses is a simple but effective way of making sure that your dataset is as accurate as possible. But what happens when your IT team gives you an IP range you don’t recognize? Read below to see how to handle IP addresses with slashes in them (CIDR notation) in Google Analytics.
IP Addresses with Slashes: CIDR For Dummies
The IP range that you’re probably used to seeing is something like XXX.XXX.XXX.XXX, where each XXX is what’s called a “class.” The first XXX is class A, the second class B, the third class C and the fourth class D. Each class contains a number 1-255.
For those of us at home, we most likely have only one IP address. Your single IP address might look something like this: 10.0.0.0. For larger organizations, it’s likely that you have a range of IP addresses. The range for your organization could look something like this: 10.0.0.0-10.0.0.255.
As you can guess, this number is a pain to write over and over, so it’s no wonder that developers created a shorthand for ranges like this called CIDR. CIDR (pronounced cider) stands for Classless Inter-Domain Routing.
Truthfully, CIDR is more complex than I’m making it out to be. More than just a nice shorthand, CIDR was developed as a new way to allow network administrators more flexibility when assigning IP addresses. This flexibility was important in making sure that there weren’t unused IP addresses like there was before. In our example above, the IP range would be abbreviated as 10.0.0/24.
Does Google Analytics Support CIDR?
As of right now, no Google does not support CIDR.
How To Handle CIDR in Google Analytics
While CIDR notation helps network administrators lighten their workload, it adds a little bit to our workload. First, you’ll need to convert your CIDR notation into a range of IP addresses.
Your next step is to take your range and convert it to RegEx, which Google does support. I personally like this website because it does both for you in one step: https://d-fault.nl/CIDRtoRegEx. If you’re unfamiliar with RegEx, I’ve got a handy article on regex 101 here.
Summary
If your IT team gives you an IP address range that has a slash in it, don’t place it directly into Google Analytics. You’ll want to convert the CIDR notation (IP addresses with slashes) to RegEx so that Google can understand it and you can make sure you’re filtering out the right IP addresses.