跳到正文
Skillpedia
分析与电子表格41k · #6975

filtering-bot-traffic

它能做什么

这项技能教智能体在 PostHog 数据中识别机器人、爬虫和 AI 代理,并将它们从你的数字中去除。适合希望分析数据只反映真实访客的网站所有者。

适用场景

  • ✓当你想从页面浏览量或其他报告中去除机器人的时候。
  • ✓当你想了解有多少流量来自机器人或 AI 爬虫的时候。
  • ✓当你想知道某个特定的 AI 工具是否访问过你的网站的时候。

技能链接

https://github.com/PostHog/posthog/blob/master/products/web_analytics/skills/filtering-bot-traffic/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/PostHog/posthog/blob/master/products/web_analytics/skills/filtering-bot-traffic/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“我的网站流量中有多少是机器人?请把去除机器人后的数字展示给我。”

每周 5 个新技能,1 分钟读完。

工作原理

PostHog 会根据每个请求的用户代理对其进行分类。智能体会在查询或图表构建器中使用这些分类,从而在历史报告中包括或排除机器人流量。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Filtering and measuring bot traffic

PostHog classifies every request by user agent so you can tell humans apart from bots, crawlers, and AI agents anywhere HogQL runs — the SQL editor, insights, trends, and Web analytics breakdowns. This skill teaches you (the agent) how to use that classification to:

  • exclude bots so analytics reflect human traffic only
  • measure how much traffic is automated, and which bots / operators are responsible
  • separate AI-agent traffic (worth measuring) from noise (worth dropping)
  • pick the right surface — virtual properties for the insight builder, functions for raw SQL

For real-time ("right now", last 30 min) bot questions and the Live tab tiles, use the exploring-live-traffic skill instead. This skill is for historical windows, saved insights, dashboards, and filtering.

When to use this skill

Use it when the user wants to:

  • exclude or filter out bots ("remove bots from my pageviews", "humans only")
  • quantify automated traffic ("what % of traffic is bots?", "how much is AI crawlers?")
  • find which bots hit them ("which crawlers visit us?", "is ChatGPT reading our docs?")
  • break a trend down by traffic type or bot name
  • measure AI-agent / AI-search traffic specifically (AEO / answer-engine visibility)

Do not use it for the Live tab, real-time numbers, or the per-minute bot charts — that is exploring-live-traffic.

The classification surface

Two equivalent ways to reach the same classification. Prefer virtual properties in the insight builder and filters; use functions in hand-written SQL or when you need a value the virtual properties don't expose.

Virtual properties (insight builder, filters, breakdowns)

These read the user agent for you (falling back from $raw_user_agent to $user_agent), so you don't pass anything in. Available wherever you pick an event property.

Property Value
$virt_is_bot boolean — true for bots / crawlers / automation
$virt_traffic_type Regular, AI Agent, Bot, or Automation
$virt_traffic_category finer category, e.g. ai_crawler, ai_search, ai_assistant, search_crawler, seo_crawler, social_crawler, monitoring, http_client, headless_browser, no_user_agent, regular
$virt_bot_name display name, e.g. Googlebot, GPTBot, ClaudeBot
$virt_bot_operator company behind the bot, e.g. Google, OpenAI, Anthropic

HogQL functions (raw SQL)

Pass properties.$raw_user_agent (and optionally properties.$ip) as is, the same arguments the virtual properties use. Don't wrap it, e.g. in coalesce(...): server and mobile SDK events (and cookieless events) are exempt from the empty-UA rule only when the argument is that plain field.

Function Returns
isLikelyBot(ua) true on a bot pattern or empty UA (server/mobile SDK events exempt)
getTrafficType(ua) AI Agent / Bot / Automation / Regular
getTrafficCategory(ua) subcategory; regular for humans
getBotType(ua) same subcategory but empty string for humans — handy for filtering
getBotName(ua) bot name; empty for humans
getBotOperator(ua) operator
常见问题

这项技能涵盖实时机器人流量吗?

不涵盖。实时机器人问题由单独的实时流量技能处理,本技能针对历史报告。

它能说出访问我网站的机器人名称吗?

可以。它可以按机器人名称和运营方来拆分流量,让你看到哪些爬虫在其中。

我可以在已保存的分析和仪表板中使用吗?

可以。它适用于历史时间范围、已保存的分析、仪表板和筛选器。

详情

作者的原始描述

Identify, measure, and exclude bot / crawler / AI-agent traffic in PostHog web and product analytics using the traffic classification surface (the isLikelyBot / getTrafficType HogQL functions and the $virt_* virtual properties). Use when the user asks to "exclude bots", "filter out crawlers", "remove bot traffic from my numbers", "how much of my traffic is bots / AI crawlers", "is GPTBot / ChatGPT / Claude hitting my site", "break down traffic by human vs bot", or wants clean human-only counts in an insight or dashboard. For the real-time Live tab bot tiles, use exploring-live-traffic instead.

repo: PostHog/posthog

热度

GitHub 星标
41k
排名
#6975
许可证
—
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能