这个工具做什么
search_performance.py 连接 Google Search Console API,拉取你站点的真实展示、点击和排名数据。这告诉你 Google 实际上把你的页面关联到哪些查询词。
为什么这很重要 — Search Console 数据是 SEO 最可靠的信号源。它显示 Google 实际认为你的页面是关于什么的——不是你以为的。
前提条件
需要 Google Cloud 项目,启用 Search Console API,并创建服务账号或 OAuth 凭证。这是工具包里配置最多的一个。
创建凭证
访问 Google Cloud Console → APIs & Services → 启用 Google Search Console API → 创建 OAuth 2.0 凭证(桌面应用类型)。
下载凭证 JSON
保存 client_secret.json 文件。放在脚本同目录下,或用 --creds 指定路径。
在 Search Console 验证站点
你的站点必须在 Google Search Console 中验证。使用属性 URL(如 sc-domain:example.com 或 https://example.com/)。
基本用法
python3 -m zens_ink search_performance --site "sc-domain:example.com" --creds client_secret.json
首次运行会打开浏览器要求 OAuth 授权。后续运行使用缓存的凭证。
| 查询词 | 展示 | 点击 | 平均排名 | CTR |
|---|---|---|---|---|
| ai tarot reading | 2,400 | 45 | 8.3 | 1.9% |
| tarot card meanings | 1,800 | 12 | 22.1 | 0.7% |
| free tarot yes or no | 950 | 38 | 4.2 | 4.0% |
| dream interpretation | 620 | 3 | 31.5 | 0.5% |
从自己的数据中找机会
第 5–15 名的甜蜜区 — 排名在第 5 到 15 位的关键词是你最大的机会。你离第一页很近——一点内容优化就可能把你推进前列。优先把精力放在这里。
日期范围
拉取特定时间段的数据:
python3 -m zens_ink search_performance --site "sc-domain:example.com" --start 2025-01-01 --end 2025-06-30
导出分析
python3 -m zens_ink search_performance --site "sc-domain:example.com" --format csv > gsc_data.csv
接下来?
你现在知道 Google 认为你的站点是关于什么的,以及你在哪些词上接近突破。最后一块拼图:竞争对手在排哪些你还没做的词?