摘要
让你的 AI 分析 Yandex Metrica 的网站分析数据:计数器、目标、过滤器和分群,关于访问、来源、页面和转化的表格、时间序列、下钻和对比报告,以及通过 Logs API 获取的原始访问和命中(hits)数据。
引导式设置
2 分钟将 Yandex Metrica 连接到 Meta Muse
开始 AnythingMCP Cloud 免费试用,在引导式设置中连接 Yandex Metrica,再把你的 MCP URL 添加到 Meta Muse。无需代码,也无需自行运行服务器。
无需信用卡 · 7 天试用 · 提供自托管方案
试试这样问
Yandex Metrica 的示例提示
点击任意提示即可复制,然后粘贴到 Claude、ChatGPT、Cursor、Gemini、Copilot 或 OpenClaw 中,在该连接器上运行。
Claude 是 AI,可能会出错。请核对回答。
💡 无需安装? 直接使用 cloud.anythingmcp.com。 登录、点击 Connectors → Yandex Metrica、粘贴凭证、生成 MCP API key,即可完成。无 Docker、无
git clone、无本地服务器。
Yandex Metrica + Meta Muse
让你的 AI 分析 Yandex Metrica 的网站分析数据:计数器、目标、过滤器和分群,关于访问、来源、页面和转化的表格、时间序列、下钻和对比报告,以及通过 Logs API 获取的原始访问和命中(hits)数据。
前提条件
完整的设置说明已内置在连接器中 (在 store 中选择连接器时可见)。所需环境变量:
YANDEX_METRICA_TOKEN
步骤 1 — 获取凭证
设置大约需要 5 分钟。你需要一个拥有 Metrica 计数器或能访问这些计数器的 Yandex 账号,以及一个在 oauth.yandex.com 上注册的自有应用。
- 在 oauth.yandex.com 创建一个类型为 For API access or debugging 的应用,并授予它 metrika:read 权限(Metrica 统计数据、计数器设置、计数器列表)。记下它的 ClientID。
- 用拥有或能查看这些计数器的 Yandex 账号登录后,打开填入你的 ClientID 的
https://oauth.yandex.com/authorize?response_type=token&client_id=<ClientID>,把令牌(以y0_开头)复制到YANDEX_METRICA_TOKEN,前面不要加 OAuth 或 Bearer。 - 安装连接器并运行
yandex_metrica_list_counters:它会检查令牌,并列出其他工具需要的计数器 ID。
Cloud 和自托管的方式相同:你只需粘贴令牌,连接器在每次调用时以 Authorization: OAuth ... 的形式发送它。无需在 AnythingMCP 中设置 Redirect URL。
令牌有效期约一年:持续使用时会自动延长。这里的所有操作只需读取权限:metrika:read 涵盖报告、计数器设置和 Logs API 请求。
先查计数器和目标:计数器 ID 在报告中填入 ids,在其他地方填入 counterId。yandex_metrica_list_goals 提供目标 ID,目标指标的名称中会包含它,例如 ym:s:goal123reaches 和 ym:s:goal123conversionRate。
指标、日期和过滤器:指标和维度以 ym:s: 开头表示会话(访问),以 ym:pv: 开头表示页面浏览,例如 ym:s:visits、ym:s:bounceRate 或 ym:s:lastTrafficSource。日期可以用 YYYY-MM-DD、today、yesterday 或 30daysAgo。过滤器使用 ==、!=、=@(包含)和 =~(正则表达式),可用 AND 和 OR 组合;yandex_metrica_list_segments 中保存的分群可以作为过滤器重复使用。行通过 limit(默认 100,最多 100,000)和从 1 开始的 offset 分页。
抽样数据:报告的返回结果包含 sampled 和 sample_share。当 sampled 为 true 时,数值是估算值:日期范围较短时可以要求完整精度(accuracy full),否则请使用 Logs API。
Logs API:未经抽样的原始访问和命中数据在 Yandex 一侧准备。AI 先用 yandex_metrica_evaluate_log_request 检查请求能否创建,然后创建请求,等到状态变为 processed,再把每个部分下载为制表符分隔的文本,第一行是字段名。日期范围不能包含今天,准备好的日志会计入计数器的日志存储配额。
限制:每个用户每天 5,000 次请求,每 5 分钟 200 次报告请求,最多 3 个并行请求;每个 IP 地址每秒 30 次请求(Logs API 为 10 次)。超出后 Yandex 返回 429:稍等后再试。
常见错误:401 表示令牌错误、已过期或已被撤销:按第 2 步用你应用的 ClientID 重新获取。403 表示令牌有效,但其账号无权访问该计数器,或应用缺少 metrika:read。400 表示指标、维度或过滤器无效,错误信息会指出是哪一个。
可读取的内容:计数器,包括网站、镜像站点、状态、时区、代码状态、所有者和你的权限,以及用来归类计数器的标签(文件夹);目标,包括类型、条件、步骤和价值;数据过滤器、URL 处理规则、保存的分群,以及谁有权访问某个计数器;关于访问、用户、跳出率、流量来源、页面、国家、设备和目标转化的表格、时间序列、下钻和对比报告;以及来自 Logs API 的未经抽样的原始访问和命中数据。
安装时默认关闭:yandex_metrica_clean_log_request。它会删除已处理的 Logs API 请求所准备的文件,以释放计数器的日志存储配额,删除后这些文件无法再下载。只有需要时才在连接器页面开启它;AI 在每次更改前都会先征得你的确认。yandex_metrica_create_log_request 和 yandex_metrica_cancel_log_request 默认开启:它们只在 Yandex 一侧开始或停止准备原始数据导出,不会更改任何计数器、目标或设置。
不包括:创建或编辑计数器、目标、过滤器和访问权限,以及上传离线转化、通话、费用、用户参数或 CRM 数据。
步骤 2 — 安装 adapter
curl -fsSL https://raw.githubusercontent.com/HelpCode-ai/anythingmcp/main/docker-compose.quickstart.yml -o docker-compose.yml
printf 'JWT_SECRET=%s\nENCRYPTION_KEY=%s\n' "$(openssl rand -hex 32)" "$(openssl rand -hex 32)" > .env
docker compose up -d
步骤 3 — 在 Muse 中添加连接器
你的服务器 URL: 在 AnythingMCP 中打开 MCP Servers → 此连接器所在的服务器,复制它的 URL(
https://cloud.anythingmcp.com/mcp/…)。本指南中出现YOUR_SERVER_ID的地方都用它替换。
Muse 以自定义连接器的形式添加远程 MCP 服务器,并通过 OAuth 登录。
- 在 Muse 中打开 Settings → Connectors,选择 Add custom connector。
- 粘贴 MCP 服务器 URL
https://cloud.anythingmcp.com/mcp/YOUR_SERVER_ID。 - Muse 会打开 AnythingMCP 的登录页面:登录并批准访问。
- 在聊天中,向 Muse 提出需要用到
Yandex Metrica的工具的请求。
你也可以在聊天中完成设置,适用于网页版、iOS 和 Android 应用以及 WhatsApp。给 Muse 发送这条消息:
Create a Custom Connector for a new remote MCP server, then connect to it:
Name: AnythingMCP
Transport: remote streamable HTTP
URL: https://cloud.anythingmcp.com/mcp/YOUR_SERVER_ID
Auth: OAuth
自托管?请用你实例的公网 HTTPS 地址替换 https://cloud.anythingmcp.com。Muse 从 Meta 的云端连接,因此 localhost 无法使用。
可用工具
| Tool | What it does |
|---|---|
yandex_metrica_list_counters | List the Metrica counters (tags) the token can read: id, name, site, status, owner_login, permission (own, view, edit), time zone, creation… |
yandex_metrica_get_counter | Get one counter's settings: name, site and mirrors, status, time zone, code status, webvisor and e-commerce options, owner and, with field… |
yandex_metrica_list_goals | List the goals of a counter: id, name, type (url, action, number, step, phone, email, form, messenger ...), conditions, is_retargeting and… |
yandex_metrica_get_goal | Get one goal of a counter by id: name, type, conditions, steps of a composite goal and price |
yandex_metrica_list_filters | List the data filters of a counter (include or exclude traffic by IP, URL, title, referrer ...): id, attr, type, value, action, status |
yandex_metrica_list_operations | List the URL operations of a counter (cut query parameters or fragments, merge to lowercase, replace domain): id, action, attr, value… |
yandex_metrica_list_segments | List the saved segments of a counter: segment_id, name, expression (a filter you can pass as filters in reports), status, segment_source… |
yandex_metrica_list_grants | List who has access to a counter: user_login, perm (view or edit), created_at and comment |
yandex_metrica_list_labels | List the user's counter labels (folders): id and name |
yandex_metrica_get_report | Build a table report from the Reporting API: metrics grouped by dimensions over a date range, with filters, sorting and paging |
yandex_metrica_get_report_by_time | Build a time series: the metrics per day, week, month, hour or other interval for the top rows of the dimensions |
yandex_metrica_get_drilldown | Build a tree report: the first dimension's values with their metrics, then expand one row into the next dimension with parent_id |
yandex_metrica_compare_segments | Compare two segments or periods side by side: the same metrics and dimensions for segment A (date1_a, date2_a, filters_a) and segment B… |
yandex_metrica_evaluate_log_request | Check whether a Logs API request for raw visits or hits can be created: possible (true or false) and max_possible_day_quantity |
yandex_metrica_create_log_request | Create a Logs API request that prepares raw, unsampled visits or hits for a date range on Yandex's side |
yandex_metrica_list_log_requests | List the Logs API requests of a counter: request_id, source, fields, attribution, status (created, processed, canceled, processing_failed… |
yandex_metrica_get_log_request | Get one Logs API request: status and, once processed, the parts (part_number and size) to download |
yandex_metrica_download_log_part | Download one part of a processed Logs API request as tab-separated text, the first line holding the field names |
yandex_metrica_cancel_log_request | Cancel a Logs API request that is still being prepared (status created) |
yandex_metrica_clean_log_request | Delete the prepared files of a processed Logs API request to free the counter's log storage quota |
示例提示
- “上个月哪些流量来源带来的访问最多?它们的跳出率分别是多少?”
- “过去三个月里,我的订单目标的转化率每周是怎么变化的?”
- “按流量来源比较 10 月和 9 月的访问量和目标达成数。”
- “昨天哪些页面的浏览量最高?来自哪些设备?”
- “通过 Logs API 获取上周未经抽样的原始访问数据,并按地区统计。”
FAQ
Muse 在哪些地区可用? Meta 目前在美国和加拿大提供 Muse,可在网页版、iOS 和 Android 应用以及 WhatsApp 中使用。
Meta 会审核这个连接器吗? 不会。Meta 不审核自定义连接器。Muse 只能看到你在 AnythingMCP 中为此 MCP 服务器启用的工具,你也可以随时在 Settings → Connectors 中断开它。
下一步
这份指南对你有帮助吗?