bot-traffic-detection

bot-traffic-detection is a skill for Claude Code from surendranb/google-analytics-mcp. It costs 21 tokens per session (589 once invoked), scanned A, original, MIT.

A guide to finding bot, scraper, and spam visits in Google Analytics 4 and excluding them from analysis. Bots are automated programs that visit websites rather than real people.

In plain words
What is it for?
Use it to inspect low-engagement sessions, suspicious referral sources, page-view patterns, and hostnames before setting a clean reporting baseline.
Why use it?
It helps explain suspicious traffic spikes and prevents automated visits from distorting engagement and traffic reports.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the google-analytics-mcp plugin — 16 skills, 1 MCP server shipped together

Good fit Use it to inspect low-engagement sessions, suspicious referral sources, page-view patterns, and hostnames before setting a clean reporting baseline.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/surendranb/google-analytics-mcp/bot-traffic-detection
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add surendranb/google-analytics-mcp --skill bot-traffic-detection
Clone the repo
git clone --depth 1 https://github.com/surendranb/google-analytics-mcp

Made for: Claude Code.

Or install google-analytics-mcp, the plugin that ships this one along with the rest of its 16 skills, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for bot-traffic-detection

README.md
[![agentmods](https://agentmods.dev/badge/skills/surendranb/google-analytics-mcp/bot-traffic-detection.svg)](https://agentmods.dev/skills/surendranb/google-analytics-mcp/bot-traffic-detection)
Your own site
<a href="https://agentmods.dev/skills/surendranb/google-analytics-mcp/bot-traffic-detection"><img src="https://agentmods.dev/badge/skills/surendranb/google-analytics-mcp/bot-traffic-detection.svg" alt="Measured on agentmods" height="20"></a>
Per session 21 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 589 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00021 $0.00589
Opus 5 $0.00010 $0.00295
Sonnet 5 $0.00004 $0.00118
Haiku 4.5 $0.00002 $0.00059

Measured 9d ago against content hash 5f12bdee7080, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

bot-traffic-detection scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/bot-traffic-detection/SKILL.md · 78 lines

How it starts

The opening of the file, as written. The whole thing — 78 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Bot Traffic Detection

Identify and exclude bot, scraper, and spam sessions from GA4 data.

When to use

  • Traffic has unexplained spikes that don't correlate with any activity
  • Bounce rate is 0% or near-100% across many sessions
  • Sessions show 0 engagement time but high pageview counts
  • Referrers look suspicious (random domains, unrecognised TLDs)
  • You want to establish a clean baseline before any analysis

How to detect

Step 1 — Check engagement time distribution

Query sessions with very low or zero engagement:

dimensions: ["sessionDefaultChannelGroup", "sessionSource", "sessionMedium"]
metrics: ["sessions", "userEngagementDuration", "bounceRate", "screenPageViewsPerSession"]
date_range: last 7–14 days

Bot signals: userEngagementDuration near 0, screenPageViewsPerSession exactly 1, bounceRate at 1.0 (100%).

Step 2 — Inspect referrer sources

dimensions: ["sessionSource", "sessionMedium", "sessionDefaultChannelGroup"]
metrics: ["sessions", "userEngagementDuration", "newUsers"]
dimension_filter: sessionMedium = "referral"

Flag sources where userEngagementDuration / sessions < 2 seconds.

Step 3 — Check hostname

dimensions: ["hostname"]
metrics: ["sessions", "screenPageViews"]

Bot traffic often hits unexpected hostnames (staging domains, raw IPs, or hostnames you don't own). Filter to your known production hostnames.

Step 4 — Geographic anomalies

dimensions: ["country", "city", "sessionSource"]
metrics: ["sessions", "userEngagementDuration"]
dimension_filter: country = [countries with no expected traffic]

Clusters of sessions from unexpected countries with 0 engagement = bot signal.

Exclusion approach

GA4 does not have a native bot filter toggle beyond the automatic Google filter. To exclude suspected bot traffic from your analysis, add a dimension filter:

dimension_filter: {
  "filter": {
    "fieldName": "sessionDefaultChannelGroup",
    "stringFilter": {"matchType": "EXACT", "value": "Direct"}
  }
}

…combined with a metric filter on userEngagementDuration > 0.

Read the full file on GitHub · 78 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 78 lines · 21 tokens per session scan A 5f12bdee7080

Subscribe to this mod's changes

bot-traffic-detection is a skill published in the GitHub repository surendranb/google-analytics-mcp (241 stars, last pushed 6d ago), licensed MIT. It adds 21 tokens to every session and 589 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories