A common functionality in Google Analytics is filtering internal traffic so that it doesn’t pollute your site’s statistics. Most Analytics admins may be used to filtering out internal traffic a certain way in Universal Analytics. In Google Analytics 4, the latest version of GA, filtering out internal traffic is done a bit differently. In this article, I’ll explain how to do it.
How to filter internal traffic in Google Analytics 4 by IP address
To filter internal traffic from your Google Analytics 4 property, follow the steps below.
Elegant Themes offers two amazing WordPress themes (Divi en Extra) for just $89 per year OR $249 for lifetime access!
Step 1: Data Stream
The first step into filtering internal traffic by IP address, is by going to your Data Stream in GA4. To go there, go to the Admin section (bottom left of your screen):
Once you’ve reached the Data Streams screen, click on the data stream that you’d like to filter traffic for. Usually, this is the stream listed under “Web”:
Now scroll down to Additional Settings and select More Tagging Settings. Then, click Define Internal Traffic. You will find that there are no internal traffic rules set up yet, so click Create in this screen:
Create the internal traffic rule by entering a name (you can choose one). Leave the traffic_type value as “internal” and then add the relevant IP addresses you want to filter out (you can add more by clicking “Add condition”).
When done adding IP addresses, click the blue Create button once more and go back to the main Admin page of your GA4 property.
Step 2: Data Settings
Now that you’re back in the main admin screen, find the Data Settings > Data Filter menu. Then click Create > Internal Traffic.
In the filter details, proceed with the following settings:
Next up, set the Filter state to Testing. This will help us to verify whether our filter is working in the next step! When done, click the Create button on the top right of your screen.
Step 3: Test the filter
Now that the filter has been set up with the Testing state, navigate to your GA4 property’s Home screen and then click the “View realtime →” link:
Now on the top of the screen, add a comparison by clicking the Add comparison button:
In the Build comparison panel, choose the following options:
Select Exclude from the drop down, then select Test data filter name from the Dimension list, and select Internal Traffic as your Dimension value. Then click the Apply button.
After applying the comparison, you should see two panels of Realtime analytics. The one on the left (“All users”) should show the recent traffic, including your pageviews. The one on the right however, should exclude the traffic from the IP address you’ve entered earlier. If set up correctly, it should look something like this:
Step 4: Setting the filter state to “Active”
If you have indeed successfully verified the setup, there is just one step remaining. Go back to the Admin screen of your GA4 property. Then go back to Data Settings > Data Filters and find the filter we created in step 2.
Now click the 3 dots on the right side of the filter and select Activate filter:
The Current state of your filter should now change into Active, which means the filter is now activated. Your GA4 property will now filter out the IP address(es) that you’ve indicated in step 1.