← All resources Tutorial

How to exclude IP addresses in GA4 (internal traffic)

Every visit from your office, your agency or your own phone looks like a customer to GA4. On a small site those visits can be a visible share of all sessions, and they land exactly where it hurts: on the pages you test, the forms you try out and the checkout you click through before a release. GA4 can leave them out, but it takes two settings in two different menus, and the second one is easy to forget. This guide walks through both, shows how to test before anything is removed for good, and ends with where the GA4 method stops working.

Part of the GA4 setup guide, step 6. You need the Editor role (or higher) on the GA4 property.

How GA4 excludes IP addresses

GA4 has no single "exclude IP" switch. It works in two stages. First, a rule in your web data stream recognises traffic from your addresses and gives each of its events a parameter called traffic_type with the value internal. Second, a data filter on the property excludes events that carry that value. The rule alone changes nothing in your reports, and the filter alone has nothing to match. You need both.

1Find the addresses to exclude

Start with the public IP address of every place your team works from: the office connection, the exit address of your VPN if you use one, and your agency's office. The rule screen in step 2 has a "What's my IP address?" link that shows the public address of the device you are on.

Check both IP versions. Many office and home connections have an IPv6 address next to the IPv4 one, and a browser can use either, so a rule with only the IPv4 address can miss part of your visits. GA4 accepts both.

Ask whoever manages the network whether the address is fixed. Business connections usually are. Home and mobile connections change, sometimes daily, and on IPv6 a device often changes the last part of its address while the first part, the prefix your provider assigns, stays the same. For those connections, a range holds up better than a single address.

2Define internal traffic in the data stream

Go to Admin › Data collection and modification › Data streams, open your web stream and click Configure tag settings. Under Settings, click Show more, then Define internal traffic, then Create.

Click Add condition to add more addresses to the same rule. Conditions are OR conditions: matching any one of them is enough. Save the rule. From now on, matching events carry traffic_type: internal.

The rule belongs to the tag settings of this stream. If your property has more than one web stream, repeat it for the others.

3Create the data filter in Testing

Go to Admin › Data collection and modification › Data filters. If the list already has a filter for internal traffic, open it; if not, click Create filter and choose Internal traffic. Give it a name (up to 40 characters), keep the operation on Exclude, and check that the parameter value matches the traffic_type value from step 2. Choose Testing as the state and save.

In Testing, nothing is removed. GA4 marks matching data with the dimension Test data filter name, filled with your filter's name, so you can see what the filter would remove before it removes anything.

4Check that your own visits are labelled

Open your site from the office connection through Tag Assistant or Tag Manager Preview, which turns on debug mode, and click a few pages. In Admin › Data display › DebugView, click an event and look for traffic_type with the value internal among its parameters. If it is missing, the address in the rule does not match the address GA4 receives: compare IPv4 with IPv6, and read the server container point further down.

After a day, build a quick check in Explore: a free-form exploration with Test data filter name as a dimension and Sessions as a metric. The row with your filter's name is the traffic that will disappear. If it is far larger than your team could produce, a range is too wide.

5Switch the filter to Active

When the labelled traffic is what you expect, open the filter, set the state to Active and save. Google says a filter can take 24 to 36 hours to apply. From then on, matching events are excluded as they arrive.

Two properties of an active filter deserve a pause before you click. It is not retroactive: visits from before activation stay in your reports. And it is permanent: excluded data is never processed, so it is not in GA4 and not in the BigQuery export either.

While you are in Data filters, also look at the Developer traffic filter. It excludes events sent in debug mode, which Tag Assistant and Preview switch on, so testing a release stops adding test sessions to your reports. A property can have up to 10 data filters.

Where the GA4 method falls short

Flag people instead of addresses

For a team that works from many places, an address list is never complete. GA4 also accepts traffic_type when you send it yourself, so you can flag people instead of connections.

A common pattern: an internal page, or a bookmark with a query parameter, sets a first-party cookie such as internal_user=1 in each team member's browser. In Tag Manager, a 1st Party Cookie variable reads it, and a Lookup Table variable returns internal for the cookie value 1, with no default value so other visitors send nothing. Add traffic_type with that variable to your Google Tag: Event Settings variable, so the Google tag and every GA4 event tag send it. The same data filter then excludes those visits, whatever network the laptop is on. The cookie lives per browser, so each device and browser needs it once, and clearing cookies removes it.

Excluding addresses before GA4 with Measurebase

If your tracking runs through Measurebase, the IP Filter power-up does this one step earlier. You list addresses or CIDR ranges on the domain's Power-ups page, and requests from them are dropped before they reach your server container. That gives you three things the GA4 filter cannot:

It filters what reaches the server container; a tag that sends straight from the browser to a platform is not covered. You can run both: IP Filter for the addresses you know, and the GA4 filter or the cookie flag as a safety net.

Frequently asked questions

How many IP addresses can I exclude in GA4?

Google documents a limit of 10 data filters per property, but no limit on the conditions in an internal traffic rule.

Does excluding an IP address remove my past data?

No. A data filter only applies to data that arrives after it is active. Earlier visits from that address stay in your reports.

Can I exclude an IPv6 address in GA4?

Yes. The internal traffic rule accepts IPv4 and IPv6 addresses, as single addresses or as ranges in CIDR notation, such as 2001:db8:1234::/48.

Why do I still see my own visits after activating the filter?

Usually one of four things: the filter needs 24 to 36 hours, your browser used IPv6 while the rule has IPv4 (or the other way round), your address changed, or your hits go through a server container that passes GA4 a shortened address. Check traffic_type in DebugView first.

Can GA4 show me which IP address to exclude?

No. Google says IP addresses "are not logged or stored" in GA4, so you cannot look them up in a report. Use the "What's my IP address?" link in the rule screen from each location instead.

Continue reading

Ready to improve your tracking setup?

Start free, no credit card required. Live in about 15 minutes.

Start free