GA4 already removes traffic from known bots, automatically, and you cannot turn that off or see how much it removed. What gets through on a small service site showed up on the sites below as one landing page, one country you do not serve, one in-app browser, and almost no engagement. You can cut some of it before it reaches the site with Cloudflare, using a WAF custom rule that challenges traffic from countries you do not serve while letting known good crawlers through. Some junk you should not block at all, because the block does not fix the report or can stop real customers. For that, filter it out of your reports instead.
What does GA4 already filter?
Google's known bot traffic page is short:
- "In Google Analytics properties, traffic from known bots and spiders is automatically excluded."
- It is identified "using a combination of Google research and the International Spiders and Bots List," maintained by the Interactive Advertising Bureau.
- "At this time, you cannot disable known bot traffic exclusion or see how much known bot traffic was excluded."
So there is no checkbox to tick. Anything you still see in GA4 got past that list.
What does junk traffic look like in GA4?
Numbers from sites I work on, first published in the Direct traffic post:
| Site | What GA4 showed | What it was |
|---|---|---|
| Multi-location appliance repair site, eight days | 1,723 sessions on one article from one overseas country, all direct, all in Android WebView | Automated or junk traffic, roughly 2.8 phone taps per session |
| A cleaning company, about two months | About three quarters of sessions direct, about one in ten engaged | Mostly data centres, not people |
The signals to check in GA4, one at a time as a secondary dimension on the traffic acquisition report:
| Signal | Why it points to junk |
|---|---|
| Country | Visits from countries you do not serve are not customers |
| Landing page | Junk clusters on one page; on the appliance site it was one article |
| Browser or device | A cluster in one in-app browser, such as Android WebView, points to one source |
| Engagement | Very few engaged sessions means very few readers |
| Key events | Real visitors call and fill in forms; junk does not |
Server logs need cleaning too: fake Google visits and fake AI crawlers
Because GA4 only sees visitors who run its tag, and your server sees every request. On the cleaning company's site I read the raw server logs for five days in August 2026, and the logs needed the same cleaning as GA4:
- Fake Google visits. Checked by IP, most visits with a
google.comreferrer came from Google's own address range2001:4860::/32, which is rendering and preview, and a few more were a scanner hitting/wp-login.php. Only a small share were people, which matched the clicks Search Console reported. - Fake AI crawlers. Hundreds of requests under the GPTBot and ClaudeBot user agents went to
/.env,/s3/credentialsand/key.pem. Those are vulnerability scanners using a borrowed name, not AI crawlers. - Real crawling of content, after removing the fakes, came from OAI-SearchBot, GPTBot, Googlebot, PerplexityBot and ClaudeBot, in that order.
The rule I took from it: cut logs by IP range before counting anything, because the user agent string proves nothing. Two live sites' AI crawler logs are published as an open dataset on AI crawler data, and what they show about llms.txt is in the llms.txt measurement post.
What can Cloudflare block?
Cloudflare only acts on traffic it proxies. Its proxy status page says a proxied record lets you "Apply your Cloudflare product configurations (such as WAF rules, caching, and redirect rules) to incoming traffic," while for a DNS-only record Cloudflare "cannot optimize, cache, and protect those requests." A common setup mistake is DNS on Cloudflare with the proxy off: none of its caching or security features apply until the records are switched to Proxied.
With the proxy on, there are two tools for bots on the free plan.
Bot Fight Mode. Cloudflare's Bot Fight Mode page says it "Identifies traffic matching patterns of known bots" and "Issues computationally expensive challenges." The same page lists the trade-offs: it "may challenge API or mobile app traffic," it applies to the entire domain, and "You cannot bypass or skip Bot Fight Mode using WAF custom rules or Page Rules." If your site has a booking widget, a webhook endpoint or a form that posts to another service, test those after switching it on, because WAF custom rules and Page Rules cannot skip it.
WAF custom rules. These let you choose what to match and what to do. Cloudflare's custom rules page lists Block, Managed Challenge and Skip among the actions, and its plan table shows "All except Log" for Free, Pro and Business. For a local service business, the useful rule is the one from Cloudflare's own example on allowing verified bots, which "challenges requests from a list of countries, but allows traffic from search engine bots":
(ip.src.country in {"US" "MX"} and not cf.client.bot)
with the action Managed Challenge. The cf.client.bot field, per its reference entry, "Indicates whether the request originated from a known good bot or crawler." Cloudflare's example lists the countries to challenge. For a business that serves only the US, you can write it the other way round, (ip.src.country ne "US" and not cf.client.bot), so that requests from outside your market get a challenge and known good crawlers such as Googlebot do not.
Bot scores, which grade each request from 1 to 99, need more. Cloudflare's page on challenging bad bots says "Access to Bot Management requires a Cloudflare Enterprise plan with Bot Management enabled."
Cloudflare settings that can block crawlers and API traffic you want
Cloudflare has a managed robots.txt that it adds in front of your own file. Its documentation says "Cloudflare will prepend our managed robots.txt before your existing robots.txt, combining both into a single response," and that with training set to disallow, it blocks a list of AI crawlers including ClaudeBot, GPTBot and Google-Extended.
On the cleaning company's site, the live robots.txt carried exactly that kind of Cloudflare block, with Disallow: / for ClaudeBot, GPTBot, Google-Extended, CCBot, Bytespider, Amazonbot, Applebot-Extended and meta-externalagent. For a business that wants to be named in AI answers, that is the opposite of what it needs. In July 2026, with access to the Cloudflare account, the AI training block was set to allow and Cloudflare's robots.txt management was turned off; after that the file served only the site's own rules, and requests with the ClaudeBot and GPTBot user agents got 200.
The same site had Cloudflare's email obfuscation on. Site audit tools then reported broken links to /cdn-cgi/l/email-protection, while a real visitor saw a working address. It was a false alarm in the audit tools, not a broken page.
Check what each Cloudflare bot setting changes before you switch it on, and read the live robots.txt after.
When should you only filter, not block?
Three cases from my own work where blocking was the wrong tool:
- Fake clicks in Search Console. On the multi-location site, bursts of clicks showed up in Search Console: 28 and 125 in two hours on one day, 40 and 82 on another. The click is recorded on Google's results page before anyone reaches your site, so a server block cannot remove it from the report and can stop real customers. Those hours are subtracted in reports instead; the details are in high impressions, low clicks in Search Console.
- Form spam. On the same company, a bot submitted all four forms on the website in 41 seconds, and four junk cards reached the dispatch chat. The fix was an invisible field that people do not fill in, plus a flag for Gmail addresses with four or more dots before the @. A flagged submission is still written to the lead log with a spam mark and the visitor still sees the thank-you page. A spam filter on lead forms should mark, not delete.
- Junk that is already in GA4. You cannot remove past sessions. Build a comparison or segment that leaves out countries you do not serve and judge channels on that, as described in the GA4 audit checklist.
What to do this week
- In GA4, break down the last 30 days by country, landing page and browser. Look for one page, one country or one in-app browser with very few engaged sessions.
- Check that your Cloudflare DNS records are Proxied if you expect Cloudflare to do anything.
- If junk comes from countries you do not serve, add one WAF custom rule with Managed Challenge, excluding known bots.
- Open your live robots.txt and read every line, including any Cloudflare added.
- On forms, flag suspected spam instead of dropping it, and check the flagged list for real people.
- Keep reports clean: compare channels on a view without the junk, and on leads and jobs rather than sessions, as in the lead attribution gap post.
FAQ
Does GA4 filter bots automatically? Yes, known bots from Google's research and the IAB list. You cannot turn it off or see how much it removed.
Will blocking bots in Cloudflare clean up my GA4 history? No. A block only affects requests from the moment it is on.
Should I turn on Bot Fight Mode? Test it first. Cloudflare says it may challenge API or mobile app traffic, and WAF custom rules cannot skip it.
Does a country rule block Google?
Not if the rule includes not cf.client.bot, which leaves known good crawlers alone.
Why do I see GPTBot requests for files like /.env?
On the cleaning company's site those were vulnerability scanners using GPTBot's name. Check the IP, not the user agent.
If you want your analytics separated into people, bots and leads, see lead attribution or start with the free written diagnostic.
Related: