Bot and spam referral traffic in GA4: what gets past the built-in bot filter, and how to keep it out.
- “spam referrals in GA4”
- “bot referral traffic GA4”
- “filter bot referrals GA4”
- “GA4 custom condition traffic filter”
- “GA4 fake referral traffic from unknown domain”
- “GA4 ghost spam”
- “GA4 unwanted referrals vs spam”
- “GA4 hostname data filter”
Baris Asa, tracking consultant, London · Last checked: 29 November 2026
GA4 excludes known bots automatically and you can’t switch that off. If GA4 still shows referral sessions that never turn into orders or leads, one of three things got through. Real visits credited to the wrong site: tell GA4 to ignore that referrer. Bots that load your page like a browser: a rule that drops their events. Fake hits from nobody visiting: a rule that drops hits for domains you don’t serve.What you’ll see: more sessions in GA4, a lower conversion rate, and no matching orders. The two rules are GA4 data filters (Custom condition traffic and Web hostname traffic, both set to Exclude). Each runs in Testing for 24 to 36 hours before you switch it on, and neither touches data you already have.
Check yours (five minutes):
- In GA4, Explore (the custom report builder), Blank. Rows: Session source (the site GA4 credits with the visit), then Hostname (the domain the page was served from). Values: Sessions and Engagement rate (roughly, the share of sessions where the visitor stayed or did something). Last 90 days.
- Look for one source with a burst of sessions on one landing page and engagement near zero, or a hostname that isn’t one of yours.
- On Shopify (or any platform with its own session report), open a sessions report broken down by referrer. Shopify has left identified bots out of its session reports by default since 21 to 23 September 2026, so compare dates from 24 September onwards only. A source that is large in GA4 and missing in Shopify is suspect.
If every source makes sense in both, there is nothing here to fix. If one doesn’t, read on, or hand it to whoever owns your tracking.
Excluding your own staff, and blocking bots before your tag fires (at your CDN or in server-side tagging), is in How to exclude internal and bot traffic in GA4. A spike from one country or city is in GA4 traffic spike from one country or city. This note cleans up the referral traffic GA4 still receives.
Spam referral, bot or misattributed visit: how to tell
The first thing I rule out on an audit is the harmless one.
| What it is | In your server logs? | Fix in GA4 |
|---|---|---|
| Real visit, wrong source (payment gateway, email tool, own subdomain) | Yes, normal visits | Unwanted referrals list |
| Bot that runs your tag (unfamiliar or promotional domain) | Yes, one repeated pattern | Custom condition filter, Exclude |
| Ghost hit (domain you’ve never heard of, nobody visited) | No | Web hostname filter, Exclude; replace the Measurement Protocol secret if it leaked |
For PayPal, Stripe or Klarna, read Payment gateway showing as referral in GA4 instead. A hostname you don’t recognise isn’t proof on its own: a page read through a translation service, a staging copy or a checkout on another domain can be a real visit.
The test that settles it
If GA4 says 500 sessions came from a site, your server or CDN logs (the record kept by your host, or by a service in front of your site such as Cloudflare) should show roughly 500 page requests in the same hours. If they do, and they share one browser or one page, it’s a bot. If they don’t show at all, they’re ghost hits. On Shopify, where you usually have no logs, the Shopify comparison in the check above is the nearest test. The two tools never match exactly (why), so look for a source that is large in one and missing in the other.
Google doesn’t document how ghost hits are sent. A vendor case from September 2026 showed one referrer and one country behind nearly all of a one-day jump, all on one landing page. One case is an example, not a rate.
How to exclude spam and bot referral traffic in GA4
Steps 2 to 4 need the Editor role (permission to change settings) on the property. Step 2 usually needs whoever built your tracking.
1. Write down what you found
The source, the hostname, the dates and the session count. You’ll need the number when the charts drop after the filter goes live.
2. Rule out your own senders
The Measurement Protocol lets a server send events straight to GA4 with no browser (refunds, offline sales, CRM stages). Each sender uses an API secret, a password created in GA4 (explained here). Before blaming a stranger, ask whether a developer, a plugin or a vendor sends events with your property’s secret.
Admin, Data collection and modification, Data streams, your stream, Measurement Protocol API secrets lists each secret by nickname. If one is in public JavaScript or a public repository, create a new one, switch the sender over, then delete the old one. Deleting a secret a live sender still uses stops that sender, so check first.
Google doesn’t document whether Exclude hostname or custom condition filters apply to Measurement Protocol events; it only says hostname Include filters don’t. So for fake hits sent with your secret, replacing the secret is the fix.
3. Create the filter: Custom condition or Web hostname
Admin, Data collection and modification, Data filters, Create filter. Google’s release notes don’t date the Custom condition traffic filter. If your Create filter menu doesn’t show it, a hostname filter still handles ghost hits; bots on your own domain stay in, so hide them with a report filter (see the data already there, below) until it appears.
Bots: Custom condition traffic, Exclude only. Google’s page for it names referral spam as a pattern: “100% of the anomalous visits come from a single unfamiliar or promotional referring domain”. The narrowest rule:
- Source exactly matches
spam-domain.example - AND Page path exactly matches the page it hits
Google says filters check each event’s attributes, but doesn’t say whether Source means the session’s source or only the event’s own referral data. Step 4 shows you what the rule actually caught.
Ghost hits: Web hostname traffic, Exclude. Match the hostname the fake hits carry. If they show (not set) or an empty hostname, an Exclude filter can’t target that; only an Include list of your own hostnames drops them (step 5). Exactly matches for a domain you never serve; ends with for several junk subdomains of one domain, only if no real hostname ends the same way. Don’t use contains on your own domain name: it also catches www and loses real visitors.
Set the state to Testing and save. Testing removes nothing: it labels matching events in a dimension called Test data filter name.
4. Read the test, then set it Active
After 24 to 36 hours, in Explore, build a Free form table: Session source and Test data filter name as rows, Event count as the value.
Check two things. None of your real sources, hostnames or orders is labelled. And rows with the spam source and an empty Test data filter name are close to zero. If they aren’t, the rule is missing events, usually ones fired on other pages. Replace the Page path condition with Source AND City or Browser version (the pattern in Google’s own example), read the Testing table again, and don’t loosen the Source match to contains.
Then set it Active. It starts filtering within 24 to 36 hours, on new data only. Active is permanent: a loose match that catches a real domain loses those visits.
5. Be careful with Include
A hostname Include filter keeps only the hostnames you list and drops everything else, including events with an empty hostname (except Measurement Protocol events, which Include filters don’t touch). One forgotten live domain, such as a checkout subdomain or a landing page builder, loses its visitors. I use Exclude for known junk.
Why the unwanted referrals list doesn’t remove spam
Admin, Data collection and modification, Data streams, Web, your stream, Configure tag settings, Show all, List unwanted referrals. Up to 50 unwanted referrals per data stream, one domain per condition; Editor role. A matching event gets a flag (ignore_referrer=true) that tells GA4 not to show that referrer as the traffic source.
That is the right tool for a payment gateway, because those visits are real. It is the wrong tool for spam: the sessions and events stay in your totals under another source, and a ghost hit never ran the tag the list works through. It doesn’t rewrite the past either. Google’s own example: a user who arrived from a domain before you listed it can still be credited to it when they come back directly.
What happens to the data already there
Nothing. Filters act forward. For earlier dates, hide the junk with a report filter or comparison on the source, and add a dated annotation. Every chart that crosses the go-live date shows a drop that isn’t a loss of customers. Put the date in your tracking documentation, where the next person will look.
How do I know it’s done?
- The Session source and Hostname reports show only what you expect, from the go-live date.
- The Testing table, read before Active, labelled only the junk and missed almost none of it.
- Any Measurement Protocol sender you use still works: a test event reaches GA4.
- The go-live date and the sessions removed are written down.
In the Atlas (Synctag’s catalogue of tracking faults), bot and internal traffic is F-602 , and real visits with the wrong source are F-205 and F-204 . Ghost hits are the adjacent case and aren’t filed separately.
An Active filter has no undo. If you can’t say which domains are yours, or who else sends data into your GA4, I can read it with you and leave a tested filter and a dated note.
Common questions
Can I see how much bot traffic GA4 removed?
No, Google doesn’t show it. Your server logs list crawler requests, but most crawlers never run your tag, so the gap between your logs and GA4 is not the amount GA4 excluded.
Does a data filter also remove the events from BigQuery?
Yes. Google says events dropped by an Active filter are never processed, so they are missing from reports, Explorations, the Data API and the BigQuery export as well. Events in Testing stay everywhere.
How many data filters can I have?
Up to ten per property (Google’s limit), and internal and developer traffic filters count among them. If you already run both, they use two, so keep spam rules narrow and few.
Is referral spam still a problem in GA4?
Yes, occasionally: known-bot exclusion doesn’t catch scripts that run your tag or hits sent straight to GA4. Google’s custom condition filter page names referral spam as a pattern, and its September 2026 note links a missing hostname to spam. No page gives a rate, so check your own reports.
The spam stopped by itself. Should I still filter it?
Usually not. A filter only acts on new data, so it can’t remove a burst that has ended. Annotate the dates and keep the filter slot for something that recurs.
Sources
Read on 29 November 2026:
- Google Analytics Help, Known bot-traffic exclusion (known bots and spiders excluded automatically using Google research and the IAB (Interactive Advertising Bureau) International Spiders and Bots List; “you cannot disable known bot traffic exclusion or see how much known bot traffic was excluded”)
- Google Analytics Help, Filter Custom condition traffic (to “exclude automated scripts, scrapers, and other unwanted traffic”; Source, Medium, Page path, geography, browser and device fields with AND/OR; Exclude only; Testing, then Active within 24 to 36 hours; dropped events absent from reports, Explorations, the Data API and BigQuery exports; up to 10 data filters per property; Editor role; referral spam listed as a pattern; Measurement Protocol not mentioned)
- Google Analytics Help, Filter web hostname traffic (Exclude or Include only; exactly matches, begins with, ends with, contains; Testing and Test data filter name; 24 to 36 hours to validate and for Active to take effect; new data only)
- Google Analytics Help, What’s new in Google Analytics (11 June 2026: hostname filter added; 21 September 2026: Include filters for hostnames, “Hostname Include filters will not be applied to events sent from the Measurement Protocol”, Include filters block events with empty hostnames; no entry for custom condition filters)
- Google Analytics Help, Data filters (now a short glossary entry: filters act from creation forward; the effect on data is permanent; excluded data never available in Google Analytics or BigQuery; report filters hide data without removing it)
- Google Analytics Help, Filter out internal traffic (Testing, Active and Inactive states; Test data filter name in Explore; up to 10 data filters per property; Editor role)
- Google Analytics Help, Identify unwanted referrals (full Admin path;
ignore_referrer=true, “the referrer should not be displayed as a traffic source”; a maximum of 50 unwanted referrals per data stream; Editor or above; returning users from a domain listed later can still be attributed to it) - Google for Developers, Measurement Protocol: sending events (
api_secretauthenticates requests and must be kept confidential; created under Admin, Data streams, Measurement Protocol API secrets) - Shopify Help Center, Changes to sessions and conversion rate (rollout 21 to 23 September 2026; identified bot sessions filtered out of session reports by default; Human or bot session filter where a report supports it)
- MetricsWatch, GA4 ghost referral spam (a single vendor case study of a one-day referral burst; used as an example only, not as a rate)