Why unknown domains send data to your GA4
There are 3 main scenarios where external domains send traffic to your account:
- Staging environments: a developer duplicates your site for a redesign or for tests. If they do not isolate the tracking code, every test action is counted in your reports.
- Scraping and site clones: a third-party site steals or automatically translates your HTML code without removing your GA4 code.
- GTM spam: a spammer directly copies your Google Tag Manager script (GTM-XXXXXX). Every time a visitor loads their site, it sends its data to your reports.
Result: your overall metrics are completely polluted (inflated number of sessions, engagement rate and conversion rate in free fall).
The principle: control the hostname
Every event sent to GA4 automatically carries the Hostname dimension, meaning the real domain where the action took place (for example www.example.com).
Previously, the only solution was to manually exclude each parasite domain (Exclude). The problem? It was an endless chase against new spammers.
Now, GA4 lets you reverse the logic with an allowlist (Include filter): you list only your official domains and everything else is automatically rejected.
Tutorial: Audit your hostnames in GA4
Before blocking anything, take stock of the domains that send you traffic.
1. Create the report
Go to Explore > Free form.
2. Set up the data
In the left column, add:
- Dimension: Hostname
- Metric: Sessions
Drag Hostname into rows and your metric into values. Analyze a recent period and sort by descending volume.
3. Sort your domains
- Your official domains: legitimate traffic
- Technical environments (localhost, staging.exemple.be): manage your sites and containers to send this traffic to a new property
- Spam domains and cloned sites: to block
How to permanently block parasite traffic (Allowlist)
Instead of keeping an endless blocklist, create an inclusion filter (Include) to keep only your validated domains.
- In GA4, go to Admin > Data collection and modification > Data filters.
- Click Create filter and select Web hostname traffic.
- Name your filter (for example: Allowlist - Official domains).
- In the filter type, switch from Exclude to Include only.
- Enter your legitimate domains.
- Keep the filter in the Testing state for 24 to 48 hours.
In the Testing state, GA4 tags the events to be removed with the Test data filter name dimension. Check in an exploration that your domain and subdomains do not appear there, then switch the filter to the Active state. An active filter is permanent. Also, the filter does not apply to data already collected. To remove it from your analyses, filter the exploration on your hostname.
Tools
- Google Analytics 4: explorations with the Hostname dimension, data filters.
Data quality auditing is part of the Google Analytics consultant expertise, together with the tracking audit and reporting.