Sub topic 12
What these settings cannot do
This chapter assumes you have already created an internal traffic rule, an internal traffic data filter, and an unwanted referrals list. Each of these settings is narrow. Knowing exactly where each one stops helps you decide when to use a different tool, and it keeps you from trusting a report that still contains leaks.
Where each setting acts
The three settings act at different points in the data's path. That is the source of most limitations.
The internal traffic rule only tags events. The data filter only reads that tag. The referrals list only changes how a session's source is chosen. None of them reaches back to data that was already processed.
Nothing is retroactive
Every setting in this tutorial affects only data collected after the change takes effect.
- Internal traffic rules tag events as they arrive. Events collected yesterday without a
traffic_typevalue stay untagged forever. - Data filters are applied during processing. Turning a filter to Active does not remove past internal visits from reports.
- The unwanted referrals list changes attribution for new sessions. Old sessions keep the source they were assigned, so a payment gateway that appeared as a referral last month still appears as one.
Changes also take time to apply. Plan for a delay of up to a day before a new rule, filter, or referral entry behaves as expected, and do not conclude that a setting is broken after one test visit.
There are two ways to handle the historical data:
- Accept a break in the series. Annotate the date you activated the filter, and compare periods knowing that earlier numbers include your own visits.
- Segment the history yourself. If
traffic_typewas being sent, you can exclude it in Explorations by registering it as an event-scoped custom dimension, but only data collected after registration carries the dimension. In the BigQuery export,traffic_typeis available as an event parameter, so you can exclude it in SQL for any period when it was set.
An Active filter permanently discards data
Testing and Active behave very differently.
- A filter in Testing does not remove anything. It labels matching events with the filter's name, so you can see them with the Test data filter name dimension.
- A filter in Active removes matching events during processing. The excluded events are not stored in the property.
- Setting a filter to Inactive stops it from excluding new events. It does not bring back events that were discarded while it was Active.
This is why the validation step comes before activation. If you activate a filter whose condition is too broad, for example a CIDR range that covers a shared hosting provider, you lose real customer events for as long as the filter stays on, and no setting recovers them.
Keep a written record of the exact traffic_type value, the IP rules behind it, and the date each filter changed state. That record is the only way to explain a step change in traffic months later.
IP addresses are a weak identity
An internal traffic rule decides by IP address, and IP addresses do not map cleanly onto people.
| Situation | Why the rule fails | Better approach |
|---|---|---|
| Staff working from home | Residential addresses are unknown or change | Set `traffic_type` in the page, or use a browser extension or cookie |
| Company VPN with split tunneling | Only some traffic exits through the office address | Tag by flag instead of address, or require full tunneling |
| Dynamic public IP at a small office | The address changes after a router restart or lease renewal | Ask the provider for a static address, or use a non-IP method |
| Mobile networks (carrier-grade NAT) | Thousands of unrelated users share one address | Never add these addresses to a rule |
| IPv6 | A rule written only for IPv4 never matches IPv6 visitors | Add IPv6 ranges explicitly, or compare with a regular expression |
| Contractors and agencies | Their addresses are not in your list | Share a tagging method, not an address list |
| Server-side or Measurement Protocol events | The IP the rule sees can be the server's, not the person's | Set `traffic_type` in the event payload |
The last row is easy to miss. Collection sees the address that sent the hit. If your tags run through a server container, or if you send events from a back end, an IP rule describes your infrastructure, not the visitor.
Matching has its own pitfalls. A CIDR range such as 203.0.113.0/24 matches 256 addresses, so make sure you own all of them. A regular expression is easy to get subtly wrong. The following pattern, used with the regular-expression match type, matches only the last octet values 1 through 199 on a specific network:
^203\.0\.113\.([1-9]|[1-9][0-9]|1[0-9]{2})$The dots are escaped so they match only literal dots, and ^ and $ anchor the whole string. Without the anchors, 203.0.113.5 would also match inside a longer address. This pattern leaves out .0 and .200 to .255, so an office using those addresses would stay in your data. Test every range you write against both the addresses it should match and the ones it should not.
A non-IP method, and its limits
When addresses are unreliable, set traffic_type yourself. The parameter does not care how it was set; the data filter only compares its value. This script marks a browser as internal when someone opens the site once with ?internal=1 in the URL, then keeps the mark in localStorage:
// Place this before the gtag('config') call on every page.
const params = new URLSearchParams(window.location.search);
if (params.get('internal') === '1') {
localStorage.setItem('ga_internal', '1');
}
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
const config = {};
if (localStorage.getItem('ga_internal') === '1') {
config.traffic_type = 'internal';
}
gtag('config', 'G-XXXXXXXXXX', config);The value internal must match the value in your data filter, character for character. This method has its own failure modes:
- It is per browser and per device. A new laptop, a private window, or cleared site data removes the flag.
- Anyone who knows the URL can set the flag, which matters only if you do not want visitors to exclude themselves.
- Page-level code can be missing on some templates, checkout pages, or embedded pages, so those visits remain unmarked.
Developer traffic covers only debug events
The developer traffic filter excludes events that carry debug_mode:
gtag('config', 'G-XXXXXXXXXX', {
'debug_mode': true
});It excludes only traffic that sets this flag. Testing from a staging site without debug_mode, or from a teammate's browser that never loaded your debug tag, is not covered. It is also a poor stand-in for an internal traffic filter. Real colleagues browsing the production site normally do not send debug events. If you leave debug_mode on in production code by mistake, the filter hides real users in the same way, but only when it is Active.
What the unwanted referrals list cannot do
The list tells GA4 to ignore a listed domain when it picks a session's source. For a payment gateway, a visitor who returns from the gateway no longer starts a new referral session, and the session keeps its earlier source. A pattern like this one matches the domain and its subdomains:
^(.+\.)?paypal\.com$Several things are outside what the list does:
- It does not remove sessions or events. The traffic is still counted. Only the source attribution changes. If you want to exclude the visits themselves, you need a different approach.
- It does not fix the cause. Self-referrals between your own domains usually need cross-domain measurement configured on the data stream, and the list does not replace that.
- It does not override UTM tags. A link with explicit campaign parameters is attributed by those parameters.
- It can hide real referrals. If you add a domain that also sends genuine visitors, such as a payment provider's marketing site, that traffic becomes direct or inherits an earlier source.
- It is forward-only. Past sessions keep their old attribution, as described earlier.
Traffic the settings never see
Some distortions sit outside this chapter's tools entirely.
- Bots. GA4 automatically excludes traffic from known bots and spiders. Bots that are not on that list still arrive. An internal traffic rule or referral list will not catch them.
- Spam through the Measurement Protocol. Anyone who has your measurement ID can send fake events. Filters keyed to
traffic_typedo not help unless the sender sets it. - Consent gaps. Visitors who decline analytics storage produce less data. That is a sampling bias, not internal traffic, and no filter addresses it.
- Other properties and streams. A filter and a rule belong to one property. Rules for a web stream do not apply to a second stream or a separate property.
Choosing a response
| Symptom | Likely limit | Action |
|---|---|---|
| Past reports still show office visits | Filters are not retroactive | Annotate the change date; exclude in BigQuery if `traffic_type` was set |
| Filter is Active but internal users still appear | IP changed, VPN, or a delay | Check the IP in DebugView, then check the rule's value matches the filter |
| Real traffic vanished after activation | Filter condition too broad | Set the filter to Inactive and fix the rule; lost events stay lost |
| Payment domain still shows as a referral | Pattern or timing | Confirm the match type and escape the dots; allow time for processing |
| Sessions from your own second domain | Cross-domain not configured | Configure cross-domain measurement |
Exercise
Your office changes its internet provider, and the public IP address changes. Last month's reports still contain internal visits, and the Active internal traffic filter is not catching current ones. List two things you should do and one thing you cannot do.
Show answer
Update the IP address in the internal traffic rule so new events are tagged with the same traffic_type value the filter expects, and confirm in DebugView or in Testing that new office visits carry that value. If the provider's address will keep changing, switch to a non-IP method such as setting traffic_type in the page. You cannot remove last month's internal visits from the property's reports, because rules and filters apply only to data collected after they take effect. You can only annotate the date or exclude them in BigQuery if traffic_type was recorded.
Exercise
A teammate adds ^(.+\.)?examplepay\.com$ to the unwanted referrals list and expects the gateway's visits to disappear from the Sessions count. Why will that not happen?
Show answer
The unwanted referrals list changes only source attribution for new sessions. The sessions and their events are still collected and counted. A returning visitor keeps their earlier source instead of being credited to examplepay.com, but the session total does not fall.