Sub topic 1
Why internal traffic and unwanted referrals skew your reports
Prerequisites
This chapter assumes you have a GA4 property with a web data stream, Editor or Administrator access, a working understanding of events, sessions, and traffic sources, and a list of your office or network public IP addresses.
Why internal traffic and unwanted referrals distort data
Staff visits, test checkouts, and automated monitoring all register as real users. They inflate session counts and skew conversion rates. Referrals cause a separate problem. When a payment gateway sends a customer back to your site, GA4 can record the gateway as a new traffic source. The original session then ends early, and the sale is credited to the wrong channel.
How GA4 marks traffic with traffic_type
GA4 handles internal traffic in two steps. First, a rule tags matching hits with a traffic_type event parameter. Second, a data filter uses that tag to exclude the hits from reports. You can also set the parameter directly in your tag:
gtag('config', 'G-XXXXXXXXXX', {
'traffic_type': 'internal'
});Choosing an IP match type
Pick the match type that fits how your addresses are assigned.
| Match type | Use when | Example value | Column | Column |
|---|---|---|---|---|
| equals | One fixed address | 203.0.113.25 | ||
| is in range (CIDR) | A whole block of addresses | 203.0.113.0/24 | ||
| matches regex | An irregular range | ^203\.0\.113\.([1-9] | [1-9][0-9] | 1[0-9]{2})$ |
The CIDR value 203.0.113.0/24 covers every address from 203.0.113.0 to 203.0.113.255.
Defining an internal traffic rule
- Go to Admin, then Data streams, and select your web stream.
- Select Configure tag settings, then Show more, then Define internal traffic.
- Select Create. Enter a rule name, choose a match type, and enter the IP value.
- Save the rule.# Why internal traffic and unwanted referrals skew your reports
Prerequisites
This chapter assumes you have a GA4 property with a web data stream, Editor or Administrator access, a working understanding of events, sessions, and traffic sources, and a list of your office or network public IP addresses.
Why internal traffic and unwanted referrals distort data
Staff visits, test checkouts, and automated monitoring all register as real users. They inflate session counts and skew conversion rates. Referrals cause a separate problem. When a payment gateway sends a customer back to your site, GA4 can record the gateway as a new traffic source. The original session then ends early, and the sale is credited to the wrong channel.
How GA4 marks traffic with traffic_type
GA4 handles internal traffic in two steps. First, a rule tags matching hits with a traffic_type event parameter. Second, a data filter uses that tag to exclude the hits from reports. You can also set the parameter directly in your tag:
gtag('config', 'G-XXXXXXXXXX', {
'traffic_type': 'internal'
});Choosing an IP match type
Pick the match type that fits how your addresses are assigned.
| Match type | Use when | Example value | Column | Column |
|---|---|---|---|---|
| equals | One fixed address | 203.0.113.25 | ||
| is in range (CIDR) | A whole block of addresses | 203.0.113.0/24 | ||
| matches regex | An irregular range | ^203\.0\.113\.([1-9] | [1-9][0-9] | 1[0-9]{2})$ |
The CIDR value 203.0.113.0/24 covers every address from 203.0.113.0 to 203.0.113.255.
Defining an internal traffic rule
- Go to Admin, then Data streams, and select your web stream.
- Select Configure tag settings, then Show more, then Define internal traffic.
- Select Create. Enter a rule name, choose a match type, and enter the IP value.
- Save the rule.
Exercise
Your office uses the public addresses 203.0.113.0 through 203.0.113.255. Which match type and value should the internal traffic rule use?
Show answer
Use "is in range (CIDR)" with the value 203.0.113.0/24. This covers all 256 addresses in the block with one rule.