How To Set Up IP Address Filters In Google Analytics 4 (GA4)

Setting up IP address filters in Google Analytics 4 is slightly different to setting them up in Universal Analytics. Find out how you do it here.

Published On 28/11/2020
Updated On 10/05/2023

Category: Analytics
Read Time: 4 Minutes

Google Analytics 4 (GA4) is Google’s brand new analytics platform which seeks to combine three leading technologies: Firebase Analytics, Google Signals and The Global Site Tag.

The new interface and enhanced capabilities of Google Analytics 4 can take some getting used to, but before you dive in, you may want to set up IP address filters. Filters aren’t ported over when you upgrade from Universal Analytics to Google Analytics 4, so this is an important first step to help keep your data clean.

Setting up IP filters in GA4 is slightly different to setting them up in UA, so even Google Analytics veterans may need a bit of help. Read on to find out how you can set up IP filters in Google Analytics 4.

1) Define the IP address

Before setting up the filter you’ll need to define the IP addresses that you want to exclude. To do this you’ll need to follow these steps from your GA4 property dashboard:

  1. Click ‘Admin’ and find Data Streams
  2. Within Data Streams select the data stream that you want to add IP filters to
  3. Click on ‘Tagging Settings’ within this data stream
  4. Select ‘Define Internal Traffic’
  5. Click the big blue ‘Create’ button
  6. Fill out the configuration settings:
    1. Rule name – can be any descriptive name for your defined IP
    2. traffic_type value – can be any value, but should be unique to differentiate between filters
    3. Enter the IP address you want to filter in the IP address field and select a relevant match type from the drop down
  7. Click the big blue ‘Create’ button again
define ip address in google analytics 4
Defining the IP address in data streams

2) Create the IP filter

Now you’ve defined your IP address you want to exclude, it’s time to create your IP filter. To do this you’ll need to go back to your GA4 property dashboard and follow the steps below:

  1. Click Admin and find Data Settings, within the Data Settings accordion click on the link titled ‘Data Filters’.
  2. Within Data Filters click the big blue ‘Create Filter’ button
  3. Fill out the configuration settings:
    1. Select ‘Internal Traffic’
    2. Data Filter Name – can be any descriptive name for your definition
    3. Filter Operation – select ‘Exclude’ from the drop down
    4. Under Filter events with the following parameter value enter the traffic_type value you defined when defining your IP address in the parameter value field.
    5. Keep the filter state as Testing State for now, so you can test your filters before applying them permanently
create ip data filter in google analytics 4
Creating the IP filter in data filters

3) Test the IP filter

Your IP filter should now be set up correctly, but before applying this to GA4 you’ll need to test that it works. You can do this by going back to your GA4 dashboard and following the steps below.

  1. Select ‘Realtime’ and click on the ‘All users’ segment under realtime overview. This should bring up a menu to the right hand side titled ‘Build comparison’
  2. You want to exclude IPs, so ensure the dropdown at the top reads “Exclude”
  3. Select the dimension called ‘Test data filter name’ from the drop down and under dimension values you should see the filter you’ve just created
  4. Click on this filter, then click ‘OK’ and the big blue ‘Apply’ button at the bottom of the screen.

When you’ve applied the filter only internal traffic should be shown in the realtime overview. To double check that’s the case, add a second segment, but instead of excluding traffic, make sure you’re including it.

Testing the IP filter in realtime overview

4) Activate the IP filter

Once you’re happy that the IP filter is working as it should be, go back to ‘Data Settings’ in the admin area and select ‘Data Filters’. From here you’ll be able to change the filter state to Active State which will permanently apply the filter to your GA4 property. Click ‘Save’ and you’re done!

change filter state in google analytics 4
Activating the IP filter after testing

If you need any additional support with setting up Google Analytics 4 then be sure to head to Google’s implementation guide, or contact a digital marketing consultant who will be able to help you get up and running.