连接器指南阅读约 4 分钟20 个 MCP 工具7 种语言

连接 Yandex Metrica MCP 与 ChatGPT

让你的 AI 分析 Yandex Metrica 的网站分析数据:计数器、目标、过滤器和分群,关于访问、来源、页面和转化的表格、时间序列、下钻和对比报告,以及通过 Logs API 获取的原始访问和命中(hits)数据。

HC作者:HelpCode 团队更新于 4 分钟阅读 在 GitHub 开源

无需信用卡 · 7 天试用 · 提供自托管方案

Yandex Metrica

Yandex Metrica

Let your AI analyse Yandex Metrica web analytics: counters, goals, filters and segments, table, time-series, drill-down and comparison reports on visits, sources, pages and conversions, and raw visits and hits through the Logs API.

个工具

20

区域

INTL

类别

数据分析

身份验证

API Key

所需环境变量

YANDEX_METRICA_TOKEN
在 Cloud 上一键安装

7 天免费试用 · 无需信用卡

  • 7 天免费试用
    无需信用卡
  • 符合 GDPR,SOC 2 就绪
    数据驻留欧盟,审计日志
  • 在 GitHub 开源
    开源 · AGPL-3.0
  • 支持 ChatGPT、Claude、Gemini
    任何兼容 MCP 的客户端

摘要

让你的 AI 分析 Yandex Metrica 的网站分析数据:计数器、目标、过滤器和分群,关于访问、来源、页面和转化的表格、时间序列、下钻和对比报告,以及通过 Logs API 获取的原始访问和命中(hits)数据。

引导式设置

2 分钟将 Yandex Metrica 连接到 ChatGPT

开始 AnythingMCP Cloud 免费试用,在引导式设置中连接 Yandex Metrica,再把你的 MCP URL 添加到 ChatGPT。无需代码,也无需自行运行服务器。

无需信用卡 · 7 天试用 · 提供自托管方案

ChatGPT 插件目录中的 AnythingMCP 插件可在 AnythingMCP Cloud 上回答有关企业数据库的问题(PostgreSQL、MySQL、SQL Server、Oracle、SAP HANA、SQLite、MongoDB,只读):打开插件页面 (在新标签页中打开)并点击 Install plugin。其他所有连接器都以自定义 MCP 服务器的方式添加到 ChatGPT,使用你的 AnythingMCP MCP URL。

试试这样问

Yandex Metrica 的示例提示

点击任意提示即可复制,然后粘贴到 Claude、ChatGPT、Cursor、Gemini、Copilot 或 OpenClaw 中,在该连接器上运行。

Yandex Metrica · 通过 MCP 实时
分享
Opus 4.7

Claude 是 AI,可能会出错。请核对回答。

💡 无需安装? 直接使用 cloud.anythingmcp.com。 登录、点击 Connectors → Yandex Metrica、粘贴凭证、生成 MCP API key,即可完成。无 Docker、无 git clone、无本地服务器。

Yandex Metrica + ChatGPT

让你的 AI 分析 Yandex Metrica 的网站分析数据:计数器、目标、过滤器和分群,关于访问、来源、页面和转化的表格、时间序列、下钻和对比报告,以及通过 Logs API 获取的原始访问和命中(hits)数据。

前提条件

完整的设置说明已内置在连接器中 (在 store 中选择连接器时可见)。所需环境变量:

YANDEX_METRICA_TOKEN

步骤 1 — 获取凭证

设置大约需要 5 分钟。你需要一个拥有 Metrica 计数器或能访问这些计数器的 Yandex 账号,以及一个在 oauth.yandex.com 上注册的自有应用。

  1. 在 oauth.yandex.com 创建一个类型为 For API access or debugging 的应用,并授予它 metrika:read 权限(Metrica 统计数据、计数器设置、计数器列表)。记下它的 ClientID。
  2. 用拥有或能查看这些计数器的 Yandex 账号登录后,打开填入你的 ClientID 的 https://oauth.yandex.com/authorize?response_type=token&client_id=<ClientID>,把令牌(以 y0_ 开头)复制到 YANDEX_METRICA_TOKEN,前面不要加 OAuth 或 Bearer。
  3. 安装连接器并运行 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 — 在 ChatGPT 中添加连接器

你的服务器 URL: 在 AnythingMCP 中打开 MCP Servers → 此连接器所在的服务器,复制它的 URL(https://cloud.anythingmcp.com/mcp/…)。本指南中出现 YOUR_SERVER_ID 的地方都用它替换。

ChatGPT 在网页版的 Plugins 页面把 MCP 服务器添加为插件,仅付费套餐可用,不再需要开发者模式。在 Business 工作区中只有管理员和所有者可以添加;在 Enterprise 和 Edu 中,管理员可以授予 Create plugins with MCPs 权限。

  1. 前往 chatgpt.com/plugins,点击 Add,然后选择 Add custom MCP server。
  2. 填写名称,例如 Name: Yandex Metrica。
  3. 在 Connection 下的 Server URL 中填入 https://cloud.anythingmcp.com/mcp/YOUR_SERVER_ID,Authentication 保持为 OAuth。
  4. 选择 I understand and want to continue,然后点击 Create as a plugin。ChatGPT 提示时,登录 AnythingMCP 并允许访问。
  5. 在个人插件中安装这个新插件,然后在对话中输入 @ 并选择它。

可用工具

ToolWhat it does
yandex_metrica_list_countersList the Metrica counters (tags) the token can read: id, name, site, status, owner_login, permission (own, view, edit), time zone, creation…
yandex_metrica_get_counterGet 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_goalsList the goals of a counter: id, name, type (url, action, number, step, phone, email, form, messenger ...), conditions, is_retargeting and…
yandex_metrica_get_goalGet one goal of a counter by id: name, type, conditions, steps of a composite goal and price
yandex_metrica_list_filtersList the data filters of a counter (include or exclude traffic by IP, URL, title, referrer ...): id, attr, type, value, action, status
yandex_metrica_list_operationsList the URL operations of a counter (cut query parameters or fragments, merge to lowercase, replace domain): id, action, attr, value…
yandex_metrica_list_segmentsList 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_grantsList who has access to a counter: user_login, perm (view or edit), created_at and comment
yandex_metrica_list_labelsList the user's counter labels (folders): id and name
yandex_metrica_get_reportBuild 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_timeBuild a time series: the metrics per day, week, month, hour or other interval for the top rows of the dimensions
yandex_metrica_get_drilldownBuild 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_segmentsCompare 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_requestCheck 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_requestCreate a Logs API request that prepares raw, unsampled visits or hits for a date range on Yandex's side
yandex_metrica_list_log_requestsList the Logs API requests of a counter: request_id, source, fields, attribution, status (created, processed, canceled, processing_failed…
yandex_metrica_get_log_requestGet one Logs API request: status and, once processed, the parts (part_number and size) to download
yandex_metrica_download_log_partDownload one part of a processed Logs API request as tab-separated text, the first line holding the field names
yandex_metrica_cancel_log_requestCancel a Logs API request that is still being prepared (status created)
yandex_metrica_clean_log_requestDelete the prepared files of a processed Logs API request to free the counter's log storage quota

示例提示

  • “上个月哪些流量来源带来的访问最多?它们的跳出率分别是多少?”
  • “过去三个月里,我的订单目标的转化率每周是怎么变化的?”
  • “按流量来源比较 10 月和 9 月的访问量和目标达成数。”
  • “昨天哪些页面的浏览量最高?来自哪些设备?”
  • “通过 Logs API 获取上周未经抽样的原始访问数据,并按地区统计。”

FAQ

ChatGPT 免费套餐能用自定义 MCP 服务器吗? OpenAI 只为付费套餐提供自定义 MCP 服务器的说明,Free 套餐不在其列。

下一步

这份指南对你有帮助吗?

2 分钟将 Yandex Metrica 连接到 ChatGPT

开始 AnythingMCP Cloud 免费试用,在引导式设置中连接 Yandex Metrica,再把你的 MCP URL 添加到 ChatGPT。无需代码,也无需自行运行服务器。

相关指南

连接器

连接 Yandex Metrica MCP 与 Claude

让你的 AI 分析 Yandex Metrica 的网站分析数据:计数器、目标、过滤器和分群,关于访问、来源、页面和转化的表格、时间序列、下钻和对比报告,以及通过 Logs API 获取的原始访问和命中(hits)数据。

连接器

连接 Yandex Metrica MCP 与 Microsoft Copilot

让你的 AI 分析 Yandex Metrica 的网站分析数据:计数器、目标、过滤器和分群,关于访问、来源、页面和转化的表格、时间序列、下钻和对比报告,以及通过 Logs API 获取的原始访问和命中(hits)数据。

连接器

连接 Yandex Metrica MCP 与 Cursor

让你的 AI 分析 Yandex Metrica 的网站分析数据:计数器、目标、过滤器和分群,关于访问、来源、页面和转化的表格、时间序列、下钻和对比报告,以及通过 Logs API 获取的原始访问和命中(hits)数据。

连接器

连接 Yandex Metrica MCP 与 Gemini CLI

让你的 AI 分析 Yandex Metrica 的网站分析数据:计数器、目标、过滤器和分群,关于访问、来源、页面和转化的表格、时间序列、下钻和对比报告,以及通过 Logs API 获取的原始访问和命中(hits)数据。

连接器

连接 Yandex Metrica MCP 与 Meta Muse

让你的 AI 分析 Yandex Metrica 的网站分析数据:计数器、目标、过滤器和分群,关于访问、来源、页面和转化的表格、时间序列、下钻和对比报告,以及通过 Logs API 获取的原始访问和命中(hits)数据。

连接器

Yandex Metrica MCP 服务器:流量与转化分析

让你的 AI 分析 Yandex Metrica 的网站分析数据:计数器、目标、过滤器和分群,关于访问、来源、页面和转化的表格、时间序列、下钻和对比报告,以及通过 Logs API 获取的原始访问和命中(hits)数据。