How to Filter by IP Address in GA4?

Introduction

Filtering out internal traffic from your GA4 data will insure accuracy in your reporting and analysis. This guide walks through how to define internal traffic with IP Addresses and then apply this definition to a GA4 Filter. GA4 is not as easy as the way Universal Analytics worked (like most GA4 processes). This article, along with the associated video, will step through this process completely. If you have any additional questions or comments feel free to asking in the comments below. New topic questions are always welcome! When you have setup your IP filters you can be assured of more accurate data without internal traffic from marketers, developers and other internal traffic throwing your analysis off.

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 create button you will see this screen: ga4-ip-filtering-internal-traffic-filter  

Defining Internal Traffic by an IP Address 

Enter in a unique 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 address 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. In the "Value" field we have copied 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 about Regular Expressions

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-ip-address

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 irreversible. Make sure you test your filters - to ensure no data is lost.

References:

Google Article on Filtering Internal Traffic

Google Article on Regular Expressions in Google Analytics

 


0 Comments: