How to filter internal traffic in Google Analytics 4

How to filter internal traffic in Google Analytics 4

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):

Google Analytics 4 Data Stream
Click on “Admin” and then select “Data Streams”

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”:

Open the relevant Data Stream in Google Analytics 4
Open the relevant Data Stream in Google Analytics 4

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 a new Internal traffic rule
Create a new Internal traffic rule

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”).

Add the relevant IP addresses for your internal traffic filter
Add the relevant IP addresses for your internal traffic filter

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

Navigate to Data Filters
Navigate to Data Filters

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:

Set a name for your data filter, make sure to set the operation to "Exclude" and enter the parameter value "internal"
Set a name for your data filter, make sure to set the operation to “Exclude” and enter the parameter value “internal”

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:

Click the "View realtime" link
Click the “View realtime” link

Now on the top of the screen, add a comparison by clicking the Add comparison button:

Add comparison
Add comparison

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.

Build comparison

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:

Realtime comparison
Realtime comparison

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:

Activate filter
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.

Thanks for reading my blog!
If this blog post helped you, please consider following me on Twitter or subscribing to my YouTube channel. You can also leave a comment below this article. Thank you!

6 responses

  1. Very useful article, thanks Wouter!

    1. Thanks Sander! I’m happy it was useful for you.

  2. Hi,
    I like your tutorial but I cannot select the dimension ‘test data filter name’ because it is greyed out. Therefore I cannot check if the filter is working. If I am on my site and then go to analytics I still cannot select it. Do you know why this happens?

  3. Wouter, thanks for the article!

    For IP-ranges GA4 uses CIDR notation and if you migrate from GA3 sometimes you may need to convert IP addresses in REGEX to CIDR notation. This free tool may help.

  4. Using the IP addresses doesn’t work if the company has lots of employees working remotely so I created a better method that should make it easy and intuitive for people to identify themselves as “internal” right on the website. Then we can use Comparisons, Segments, and Audiences for GA4 reporting.

    Here’s a detailed explanation.

  5. Good post, I tested my filters and saw that the filters were working, but while all of them on active, the realtime reports still show data. In the other reports, the filters seem to work.

Leave a Reply

Your email address will not be published. Required fields are marked *