How to easily filter an IP address in Google Analytics 4 (GA4)

A few months ago, Google Analytics 4 (GA4) was made available. Although it does not yet have all the options we were used to, we implement GA4 in addition to the “old” Google Analytics Universal (GA) standard for our customers.

To keep the data as clean as possible, it is important to filter at least a number of internal IP addresses in advance. Examples of IP addresses that you want to filter are the ones of the office and of staff working at home. This way you will get a less distorted picture of, for example, how many visitors have been to your website.

In this article, we briefly explain how to filter an IP address in GA4, but also why you should filter both IPv4 and IPv6, but more on that later.

IP filtering in GA4 explanation

Let’s go through the step-by-step process of how to filter an IP address from the data in Google Analytics 4.

Step 2: Navigate to the Google Analytics 4 account/domain where you want to apply this filter

Step 3: On the admin panel at the bottom left of your screen

Step 3: Filter IP address GA4

Step 4: Go to Data Settings> Data Filters

Step 4: Filter IP address GA4

Step 5: Click on “Create filter”

Step 5: Filter IP address GA4

Step 6: Choose “Define internal traffic -Define IP addresses whose traffic should be marked as internal” and click “Create” on the new screen.

Step 6: Filter IP address GA4

Step 7: Now you will see the following screen:

Step 7: Filter IP address GA4 - 1
  • Rule name: The name for the filter makes it recognizable, so it’s easy to change, filter, or remove.
  • Traffic_type value: You can use different definitions here, but when you’re filtering internal traffic, always use internal.
  • Match type: The standard format is IP address equals, but there are some other options (use them carefully). This one means that only the IP will be filtered that’s in the next field and nothing else.
  • IP address: This equals the IP address you would like to filter in GA4.

You don’t know your IP address? You can find it over here, https://whatismyipaddress.com/.

Step 7: Filter IP address GA4

It may be the case that there are 2 different IP addresses, both IPv4 and IPv6, choose one of them and enter it. Later, repeat all these steps again and then enter the other IP (I will explain the difference between IPv4 and IPv6 later in the article).

A complete overview of this step:

Step 7: Filter IP address GA4 - 2

Step 8: Everything is set up correctly, so it is time to create the filter. Click on the Create button at the top right. Filtering your IP now works, repeat all steps below if you have multiple IP addresses (do both the IPv4 version and the IPv6 version). We will discuss this further below.

IPv4 and IPv6

Several internet providers are rolling out IPv6, previously an IP always looked like 241.207.21.100 while nowadays it can also look like this 0:0:0:0:0:ffff:f1cf:1564.

What is IPv6?

IPv6 is the next-generation IP address standard that is intended to complement and ultimately replaces IPv4, the protocol still used by many Internet services. Any computer, cell phone, home automation component, IoT sensor and any other device connected to the internet needs a numeric IP address to communicate between other devices. The original IP address scheme, called IPv4, is running out of addresses by all devices connected to the Internet today.

What is IPv4?

IPv4 stands for Internet Protocol version 4. It is the underlying technology that allows us to connect our devices to the Internet. Each time a device connects to the Internet, it is assigned a unique numeric IP address, such as 99.48.227.227. The IPv4 numbers are almost gone, hence the switch to IPv6. IP filter not working? In GA Universal it could happen that filtering your own IP did not work, this was often because the GDPR law requires you to anonymize all data. Because your own IP is also anonymized before the data goes to GA, GA cannot filter your IP address. So, in short, it works as follows with the “old” Google Analytics:

Website visitors> Make IP address anonymous> Check if the IP address is filtered? (This step does not work when making IP addresses anonymous)> Display data in Google Analytics

This problem has been solved with GA4, GA4 has automatic IP anonymization built into it, where previously it was done with an extra line of code added to GA. This is no longer necessary with GA4, instead of the IP address being anonymized first and then sent to GA4, GA4 now first checks what the IP address is – if it is excluded, the data will not be included and otherwise the data anonymized. In short:

Website visitor> Google Analytics 4 goes off> Is the IP filtered? > If so, do not display the data in Google Analytics 4> If not, anonymize the IP

Conclusion

Filtering your own data is extremely important and should be set for every customer. If you have not yet set up GA4 for your website, do it quickly so that you have enough data when you really want to get started with Google Analytics.

If you like this blog, you might also like the blog about how to track Scroll Depth using Google Tag Manager and Google Analytics.

Logo Freelance CRO specialist Sander Volbeda

Working remotely from Groningen, the Netherlands. Get in touch and let’s schedule a meeting, no strings attached.

Get in touch
© 2024 Sander Volbeda, All rights reserved
CoC: 53236734 VAT: NL002247968B39