Exclude internal traffic in GA4

Exclude internal traffic in GA4

You might want to have the ability to filter out any visits and interactions with your website that are coming from company employees. Such interactions could skew your data a bit, especially when doing test purchases, completing application forms, or other actions that are considered of high value for your business.
In this post, we will take a look at an easy way how to filter your internal traffic in GA4 using either IP addresses or traffic from a debug mode.

Define internal traffic in the GA4 interface

  • Go to the GA4 Admin section by clicking a link on the bottom left side of the screen
  • Navigate to the GA4 property column and open Data Streams. From there select your web data stream.
  • Under the “Google Tag” section select “Configure tag settings“.
  • In the “Settings” section click on “Show all” to see all settings.
  • Select “Define internal traffic” from the list.
  • Click on “Create” to add a new internal traffic definition.
  • The easiest way to define internal traffic in GA4 is to provide an exact match of your IP addresses.
    You can find out what to add here just by asking Google what is your IP 🙂
    Optionally, if you are working in a large organization, you could ask for a list of IPs from your system administrator or someone who is working with the corporate network.
  • Notice that by using this setting GA4 will set the “traffic_type” parameter to a specified value. Theoretically, you can create multiple traffic type groups and then filter them out separately. E.g. “internal” for company employees, “agency” for marketing agencies, etc.
  • Once your list of IPs is added you can click “Create”. Note that you can also edit conditions or add new IP addresses here at any time.
  • Traffic type will be determined using the “traffic_type” parameter and if the visitor IP matches your conditions it will be marked with a specified traffic type value.

Now let’s take a look at what are our options for excluding such traffic from the reports.

Filter out and segment internal traffic in GA4 reports

There are two ways how you can view clean data in GA4, and both of them involve using Data Filters.
You can either use segments inside each report to exclude or separate different traffic types or just remove any hits from internal traffic completely.

By default, GA4 creates a Data Filter for internal traffic in “Testing” mode, which then can be either used for segmentation or for data exclusion.
You can find it in Admin section > Property > Data Settings > Data Filters.

Data filters in GA4

The filter name will be “Internal Traffic” and the current state is Testing. By default, it is using the “traffic_type” value “internal”.

Exclude traffic_type internal from GA4 data filter


While any filter is in the testing mode we can use it to segment reports without losing any of the collected data.

Segmenting internal traffic in GA4 built-in reports

To segment internal traffic without losing any data we can use the Testing filter as a condition in our reports.

To look at internal traffic separately in default reports we will use “Comparisons”.

  • Open the “Reports” section and select any of the default reports. Then click on “Add comparison”
Add comparison in GA4 reports snapshot
  • From the dimension list select “Test data filter name”
    NB! This dimension might be disabled if you don’t have any traffic in that filter! Usually, after adding an internal traffic parameter you can select it the next day.
Select test data filter name
  • From dimension values select “Internal Traffic”.
  • Apply the “Exclude” condition to view data WITHOUT Internal traffic or “Include” to view ONLY internal traffic.

Now any report will have an additional chart showing only internal or all traffic excluding internal.

Internal and all traffic segmented in a single GA4 report

You can also remove the “All users” segment and apply the opposite comparison to view just the non-Internal traffic versus only Internal.

Filtering internal traffic in GA4 custom reports (Explorations)

Unfortunately, at the time of writing, it’s not possible to segment internal traffic or any other traffic type in Exploration segments. If it becomes available or you know a workaround for that, let me know in the comments!

Using Data filters to exclude internal traffic completely

If you are certain that you don’t want to process any of the Internal data in GA4 reports you can completely exclude it using Data filters.

  • Open the same list of filters from the Property data settings menu and click on the Internal Traffic filter.
  • Under the “Filter state” section we see that filter is still Testing and not excluding any data from processing.
  • To change that select “Active” and save the filter. Now any incoming data with a given traffic type (in my case ‘internal’) will be excluded from any GA4 reports.
  • If you want to disable the filter for any reason you can set the filter state to “Inactive” and GA will start processing given requests again.

Exclude debug traffic from GA4 reports

It’s a good idea to separately exclude any events that are coming from testing, either through GTM preview mode or other events that have the debug_mode parameter set to “true”.
To do that we can create a separate filter.

  • Open Admin section > Property > Data Settings > Data Filters again
  • Click on “Create Filter”
  • Filter type “Developer Traffic”
  • It doesn’t have any elaborate settings. You can pick if you want to Exclude or Include such traffic and the filter state.
  • Give it a descriptive name. The filter state can be “Testing” to see if it filters out only development hits. If you are sure that no custom debug_mode parameters are applied to any of your LIVE tags you can use “Active” and exclude data from the start.

Note that even if the Debug traffic is excluded you still will be able to see and debug your hits from preview mode in DebugView.

Summary

We have reviewed how you can exclude internal or developer traffic from the GA4 interface. Note that Internal traffic exclusion is based on IP address, so if your organization’s IP can change then such an approach won’t be effective.

As the next step to explore – it is also possible to provide a “trafic_type” parameter from dataLayer which is based on custom logic (not only IP address), which would give you more flexibility on what you are able to exclude. So if the IP option doesn’t work for you, this is the option that you could look into.

Leave a Reply

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