5 days ago a website I run with free online tools went from about 5,000 to 40,000 daily users in Google Analytics in four days. Nobody shared it and no article went viral. Almost every new visitor arrived as “Direct” traffic and left within a few seconds.

It was a bot flood. This article shows how I tracked it down with GA4 and Cloudflare, why the first set of security rules failed and what finally worked.
How much web traffic comes from bots?
According to the 2026 Thales Bad Bot Report, which analyzed full-year 2025 traffic, bots now make up 53% of all internet traffic:
- 47% human traffic 🙍♂️
- 40% bad bots 👾
- 13% other bots (the remainder), such as search engine crawlers 🤖
The same report found that 41% of bots use Chrome to look legitimate. That matches what I saw: nearly all the fake visitors identified themselves as an up-to-date Chrome.
Fake visits cause problems even when your server copes with them. They distort your analytics, so you can’t tell which pages perform well or where real visitors come from.
This is worth keeping in mind if you buy website traffic to promote a new product or website. Set up your analytics before starting the campaign so you have a baseline to compare the results with. 1000 cheap visits aren’t worth much if none of the visitors are interested in your site.
Be especially careful if your website runs display ads. Invalid traffic can put your advertising account at risk.
🔍 Finding bots in Google Analytics 4
GA4 already filters out known bots. Google’s documentation says you cannot turn this off or see how much traffic it removed.
Bots that run a real browser get through anyway. Headless Chrome loads JavaScript, accepts cookies and fires analytics events like a normal visitor. Look for these signs:
- A sudden spike in traffic with no matching increase in sales, sign-ups or ad revenue.
- Almost all of the new sessions in one channel, usually Direct.
- Engagement rates in single digits and average engagement time of 0-6 seconds.
- One browser and operating system combination taking an unrealistic share of your users.
- Traffic concentrated on a single page, often one that isn’t popular in search.
- Referral traffic from unfamiliar or suspicious domains.
Don’t assume that every short visit comes from a bot. Someone looking up a CSS property might find the answer and leave five seconds later. Look for patterns across thousands of sessions, not single visits.
Step 1: Compare channels in Traffic acquisition
Open Reports > Acquisition > Traffic acquisition and set the date range to include the spike.

In my report, Direct traffic produced 98.6% of all 174,094 sessions. Its engagement rate was 19% with an average of 6 seconds, while Organic Search visitors had a 51% engagement rate and stayed 50 seconds. Referral visitors engaged 86% of the time. When one channel grows tenfold and behaves completely differently from the others, the growth isn’t human.
Step 2: Break users down by browser and operating system
Go to Reports > User > Tech > Tech details, keep Browser as the primary dimension and add Operating system as a secondary dimension.

This was the clearest evidence:
- Chrome on Linux: 62.45% of 165,549 users. Desktop Linux is a small minority among real visitors, so this alone is a red flag.
- Chrome on Windows: 34.36% of users with a 2.77% engagement rate and 1 second of average engagement time.
- Edge on Windows (62%), Chrome on Android (81%) and Safari on iOS (54%): normal engagement rates. These are the real people.
Two browser and OS combinations made up 96.8% of the audience. Compare each row’s engagement rate with the rest. Real browsers vary; bots cluster around zero.
Step 3: Check the events in Realtime
Open Reports > Realtime overview while the bots are active. In my case, 81% of all page views went to a single tool page, and nearly every session fired first_visit. That means every “visitor” arrived without cookies, a typical sign of a fresh automated browser profile.
There were also more view_search_results events than page views. GA4’s enhanced measurement fires that event when the URL contains a search parameter such as q, s or search. Unique query strings are also a common way for bots to get past a CDN cache, so the request reaches your origin server every time.
What your server logs can tell you
Google Analytics only sees visitors that run its JavaScript. A simple script can fetch every HTML page on your site without ever appearing in GA4.
Your server access logs record every request. You can usually find them in your hosting control panel. On a VPS running Apache or Nginx, check the log directory, typically under /var/log/. If your site is behind Cloudflare, Security > Analytics shows the same information with each visitor’s network (ASN), country and user agent, even on the free plan.

In 24 hours my site received 1.97 million requests. Cloudflare challenged or blocked 919,600 of them, served 583,500 from its cache and passed 468,400 to the origin server.
The busiest IP address wasn’t one of the bots in GA at all. It belonged to KeenableBot, a verified search crawler running on Google Cloud, with 4,380 requests in a day. It doesn’t run JavaScript, so it never showed up in Analytics. Only the logs revealed it.
A log line names the client in its User-Agent string:
192.0.2.20 - "GET / HTTP/1.1" 200 "Googlebot"
192.0.2.20 - "GET /contact/ HTTP/1.1" 200 "Googlebot"
192.0.2.20 - "GET /login/ HTTP/1.1" 200 "Googlebot"
Is that really Googlebot? Anyone can send a request with that User-Agent. Try it yourself with cURL:
curl -A "Googlebot" https://example.com/
The server sees Googlebot, even though the request came from your own computer. Never allow or block visitors based on the User-Agent alone.
How to check if a crawler is real
The major crawler operators let you verify their bots by reverse DNS, by published IP lists, or both.
| Crawler | Company | Purpose | Verification |
|---|---|---|---|
| Googlebot | Search indexing | googlebot.com or IP ranges | |
| Bingbot | Microsoft | Search indexing | search.msn.com |
| Applebot | Apple | Siri and Spotlight search | applebot.apple.com or IP ranges |
| GPTBot | OpenAI | AI training data | IP ranges |
Let’s say your logs show a “Googlebot” request from 66.249.66.1. On Windows, open Command Prompt and run a reverse lookup:
nslookup 66.249.66.1
Name: crawl-66-249-66-1.googlebot.com
Address: 66.249.66.1
The hostname ends in googlebot.com. Now look up that hostname and make sure it points back to the same IP:
nslookup crawl-66-249-66-1.googlebot.com
Name: crawl-66-249-66-1.googlebot.com
Address: 66.249.66.1
Both checks match, so this is the real Googlebot. On Linux or macOS, host 66.249.66.1 does the same job. A convincing hostname alone isn’t enough: anyone who controls an IP address can set its reverse DNS to any name, but they can’t make Google’s DNS point back to it.
Cloudflare does this verification for you. Its cf.client.bot field, shown as Known Bots in the rule builder, is true only for verified crawlers. Add and not cf.client.bot to your rules to keep search engines out.
Can’t I just block bots in robots.txt?
You can ask them to stay away from certain pages:
User-agent: *
Disallow: /private/
Well-behaved crawlers respect this. Malicious ones ignore it. The robots.txt file is a set of instructions, not access control.
Why Cloudflare challenges didn’t stop the bots
Cloudflare’s free plan allows 5 custom rules. Mine all challenged suspicious traffic, including a site-wide Managed Challenge for every visitor that wasn’t a verified bot:

It looked airtight. Yet the GA numbers kept climbing. The Security actions card in Security Analytics showed why:

Of 711,150 Managed Challenges, 452,060 requests were “Managed Challenge Bypassed”. These requests already carried a cf_clearance cookie from an earlier, successfully solved challenge, so Cloudflare let them through without checking again.
When I filtered the analytics to just the bypassed requests, none of them had been mitigated. 98% claimed to be Chrome and 63% ran on Linux, the same fingerprint as the fake GA users. A bot running a real Chrome browser solves the Managed Challenge once, usually without any visible puzzle, and then reuses the cookie. According to Cloudflare’s documentation, the cookie lasts 30 minutes by default.
A challenge filters out simple scripts. It doesn’t stop automated real browsers.
What worked: blocking by network, not by behavior
The sampled logs in Security Analytics showed where the bypassed traffic came from: data center networks such as DigitalOcean. Real people browse from home and mobile ISPs, not from rented servers. I changed my rules in three ways.
1. Block cloud hosting networks instead of challenging them. This expression matches the ASNs of Alibaba Cloud (45102), HostRoyale (203020), Microsoft Azure (8075), DigitalOcean (14061), Hetzner (24940), OVH (16276), Linode/Akamai (63949), Vultr (20473) and Amazon AWS (16509, 14618), but leaves verified crawlers alone:
(ip.src.asnum in {45102 203020 8075 14061 24940 16276 63949 20473 16509 14618} and not cf.client.bot)
2. Challenge desktop Linux Chrome interactively. Only 1,500 interactive challenges were solved in a day, while hundreds of thousands of requests passed managed challenges. I added the Linux user agent to an existing rule, because all 5 free slots were taken:
(not cf.client.bot and ((http.user_agent contains "Windows NT" and (http.user_agent contains "Chrome/13" or http.user_agent contains "Chrome/14")) or http.user_agent contains "X11; Linux x86_64"))
3. Put the Block rule first. Cloudflare stops evaluating rules at the first Block or challenge that matches. If the challenge rule ran first, a bot that solved it would never reach the Block rule.

The Block rule started working immediately. Within half an hour it had stopped about 1,900 requests, and the logs showed the same headless Chrome fingerprint from DigitalOcean:

Blocking hosting networks has a cost. Some VPN users and a few legitimate services run on the same networks. On a content site, that trade-off is usually worth it. On a SaaS app or an API, check your logs for good traffic from these ASNs first.
Keep the remaining bots out of your analytics
The Chrome-on-Windows bots came through residential IP addresses all over the world. Cloudflare can’t separate them from real visitors without hurting real visitors, too. Since these bots stayed for about one second and almost never interacted with the page, you can load the analytics tag only after a real interaction:
<script>
(function () {
var loaded = false;
function loadAnalytics() {
if (loaded) return;
loaded = true;
var s = document.createElement('script');
s.async = true;
s.src = 'https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX';
document.head.appendChild(s);
window.dataLayer = window.dataLayer || [];
window.gtag = function () { dataLayer.push(arguments); };
gtag('js', new Date());
gtag('config', 'G-XXXXXXXXXX');
}
['scroll', 'pointerdown', 'keydown', 'touchstart'].forEach(function (e) {
window.addEventListener(e, loadAnalytics, { once: true, passive: true });
});
})();
</script>
Replace G-XXXXXXXXXX with your measurement ID. This doesn’t stop the bots, but it keeps them out of your reports. The trade-off: real visitors who leave without scrolling, clicking or typing won’t be counted either.
🍯 Catch form spam with a honeypot
If your contact form gets flooded with spam, try a honeypot before making everyone solve a CAPTCHA. Add an extra text field and hide it with CSS. Humans won’t see it, but many spam scripts fill in every field.
<form action="contact.php" method="post">
<label for="email">Email:</label>
<input type="email" name="email" id="email" required>
<label for="message">Message:</label>
<textarea name="message" id="message" required></textarea>
<div style="display:none" aria-hidden="true">
<input type="text"
name="website_url"
tabindex="-1"
autocomplete="off">
</div>
<button type="submit">Send</button>
</form>
Check the extra field in your PHP script before processing the message:
<?php
$website = $_POST['website_url'] ?? '';
if (!is_string($website) || trim($website) !== '') {
http_response_code(400);
exit('Invalid submission.');
}
// Continue with normal form validation.
?>
The check must run on the server. JavaScript validation won’t help against scripts that post directly to your PHP file. Test the form with browser autofill and password managers, since some fill hidden fields by mistake.

A honeypot stops basic form spam, but smarter bots skip hidden fields. If spam continues, add rate limiting or Cloudflare Turnstile.
Other ways to reduce unwanted bot traffic
- Rate limiting: Limit how many requests one IP can make to a page or endpoint. It works against aggressive scrapers, but not against bot networks that send a few requests from thousands of IPs.
- Caching: Serve public pages from the CDN cache so repeated requests don’t reach your server.
- Server-side validation: Never rely on JavaScript alone to protect forms and APIs.
- Review your rules weekly: Bot operators change user agents and networks when they get blocked. Mine had switched from a Mac fingerprint to Linux within a few weeks.
Be careful with country-wide blocks and strict IP limits. An entire office, school or mobile network may share one IP address. You could end up blocking hundreds of real people because of one suspicious visitor.
Check your traffic before celebrating a spike
More traffic doesn’t always mean more readers or customers. Before you pay for a traffic source or redesign pages based on your reports, check where the numbers come from.
Start in GA4 with channels, then browser and OS, then Realtime events. Confirm what you find in your server or Cloudflare logs. If challenges are being bypassed, block the networks the bots run on. You don’t need expensive bot detection software for this. The free tools are enough to spot the problem.