Displaying items by tag: IP Filtering

Sunday, 31 December 2023 22:18

GA4 IP Filters


How to Filter by IP Address in GA4?

A common process in keeping your GA4 data accurate is removing internal traffic.  The most common way to do that is by filtering out this traffic by IP Address.  This article will step through how to complete this process.


How to Define Internal Traffic using an IP Address?

The first step of this process is defining internal traffic using an IP Address.  We will use an example IP Address of 123.456.78.9 - you can find the right IP Address by typing in "What is my IP" in Google search or check with your network team to find a range of IP Addresses. 
Now navigate to the "Define internal traffic" page.  ( Admin -> Data streams -> click on Data Stream -> Configure tag settings -> click "Show more" -> Define internal traffic ) and you will see this screen:
 ga4 ip filtering define internal traffic
After clicking on the creat button you will see this screen:
ga4 ip filtering defininf internal traffic with an ip address 
Defining Internal Traffic by an IP Address 
Enter in a unqiue name for your "Rule name".  Notice that "traffic_type" value is defined as "internal", this is what will be used in the filter step to filter out this traffic.  You can create new "traffic_type"s at this point as well if you would like different filters, keeping in mind that there are a maximum of 10 filters allowed. 
Next select the "Match type", in this case we have selected "IP adress matches regular expression", there are other choices as well including "IP address is in range (CIDR notation)" - look here to learn more about this match type - https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing.  In the "Value" field we have coppied in our IP address and then add "\" before the "." to make it clear that we mean a period "." in our IP Address.  (The period character means a single character wildcard, using the backslash, "\", escapes the period to indicate that we mean an actual period and not a wildcard.  We will be providing a brief Regular Expression article to provide the basics that will help your GA4 analysis.  To read more - https://en.wikipedia.org/wiki/Regular_expression

How to Create a Filter in GA4?

The next step is creating (or in most cases editing) your internal traffic filter.  First navigate to Admin -> under "Data Collection and modification" click on Data filters.  From here you can Edit your "Internal Traffic" filter, or click the "Create" button to start.  You will see this:

ga4 ip filtering internal traffic filter

If the "Data filter name" is not set fill in a unique name.  Next notice that the "Parameter name" is set to "traffic_type" and the "Parameter value" is set to "internal" - in most case we can leave these alone, if you want to create additional custom filters - then the Parameter and Value will allow you to customize these settings.

Finally we will want to select the "Active" filter state - this will ensure that the traffic is permanently filtered out.  (If you only want to filter the data from reports, but want the data available, try Report Filters - here is an introduction to Exclude Filters.)  When you are complete click on the "Save" button and then click on "save filter" on the next warning that filters are destructive and irreversable.  Make sure you test your filters - to ensure no data is lost.


Google Article on Filtering Internal Traffic - https://support.google.com/analytics/answer/10104470?hl=en

Google Article on Regular Expressions in Google Analytics - https://support.google.com/analytics/answer/1034324?hl=en

Published in Blog
Tagged under