tracking-google-serp-rankings

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Tracking Google SERP Rankings

跟踪Google SERP排名

Scrapes Google Search results for any keyword(s) to show who ranks where, what SERP features appear (featured snippets, PAA, local pack, ads), and how competitors are positioned. Use for SEO audits, content gap analysis, or keyword research.
抓取任意关键词的Google搜索结果,展示排名情况、出现的SERP功能(特色摘要、PAA、本地包、广告)以及竞争对手的排名位置。可用于SEO审计、内容差距分析或关键词研究。

Prerequisites

前提条件

  • APIFY_TOKEN
    environment variable set
  • Optional: Apify MCP server installed
  • 已设置
    APIFY_TOKEN
    环境变量
  • 可选:已安装Apify MCP服务器

Inputs

输入参数

ParameterTypeRequiredDefaultNotes
startUrls
arrayOptional
[]
Google search URLs
searchTerms
arrayOptional
[]
Keywords to search on Google
countryCode
stringOptional
US
Country for Google search (e.g.
US
,
GB
,
TR
)
languageCode
stringOptionalLanguage for results (e.g.
en
)
maxItems
numberOptionalUnlimitedMaximum results to return across all queries
maxPagesPerQuery
integerOptional
1
Maximum result pages per query
mobileResults
booleanOptional
false
Fetch mobile SERP layout
customMapFunction
stringOptionalJavaScript function to transform each output object
参数类型必填默认值说明
startUrls
数组可选
[]
Google搜索URL
searchTerms
数组可选
[]
要在Google上搜索的关键词
countryCode
字符串可选
US
Google搜索的国家(例如
US
GB
TR
languageCode
字符串可选结果语言(例如
en
maxItems
数字可选无限制所有查询返回的最大结果数
maxPagesPerQuery
整数可选
1
每个查询的最大结果页数
mobileResults
布尔值可选
false
获取移动端SERP布局
customMapFunction
字符串可选用于转换每个输出对象的JavaScript函数

Workflow

工作流程

Progress:
- [ ] Step 1: Define keywords and search parameters
- [ ] Step 2: Run google-search-scraper
- [ ] Step 3: Fetch and parse SERP data
- [ ] Step 4: Map ranking positions and SERP features
- [ ] Step 5: Deliver ranking report
Progress:
- [ ] Step 1: Define keywords and search parameters
- [ ] Step 2: Run google-search-scraper
- [ ] Step 3: Fetch and parse SERP data
- [ ] Step 4: Map ranking positions and SERP features
- [ ] Step 5: Deliver ranking report

Step 1: Clarify Parameters

步骤1:明确参数

Ask the user for:
  • Keywords to track (1–20 keywords)
  • Country (default: US)
  • Language (default: English)
  • Number of results per keyword (default: 20 = top 2 pages)
  • Device — desktop or mobile (default: desktop)
  • Safe search — on or off (default: off for unfiltered results)
  • Specific domain to track (optional — e.g., "where does example.com rank for these keywords?")
向用户确认以下信息:
  • 关键词:要跟踪的关键词(1–20个)
  • 国家(默认:美国)
  • 语言(默认:英语)
  • 每个关键词的结果数量(默认:20条 = 前2页)
  • 设备:桌面端或移动端(默认:桌面端)
  • 安全搜索:开启或关闭(默认:关闭以获取无过滤结果)
  • 要跟踪的特定域名(可选——例如:“example.com在这些关键词下的排名如何?”)

Step 2: Run the Actor

步骤2:运行Actor

Recommended — run_actor.js (handles waiting, output, and file saving automatically):
bash
undefined
推荐方式——run_actor.js(自动处理等待、输出和文件保存):
bash
undefined

Quick answer (prints table to chat)

Quick answer (prints table to chat)

node scripts/run_actor.js
--actor "apidojo~google-search-scraper"
--input '{"param": "value"}'
node scripts/run_actor.js
--actor "apidojo~google-search-scraper"
--input '{"param": "value"}'

Save as CSV

Save as CSV

node scripts/run_actor.js
--actor "apidojo~google-search-scraper"
--input '{"param": "value"}'
--output YYYY-MM-DD_results.csv --format csv
node scripts/run_actor.js
--actor "apidojo~google-search-scraper"
--input '{"param": "value"}'
--output YYYY-MM-DD_results.csv --format csv

Save as JSON

Save as JSON

node scripts/run_actor.js
--actor "apidojo~google-search-scraper"
--input '{"param": "value"}'
--output YYYY-MM-DD_results.json --format json
> `APIFY_TOKEN` must be set in environment or `.env` file.

**If Apify MCP is available:**
Tool: apify:run-actor Actor: "apidojo~google-search-scraper" Input: { "queries": ["[keyword1]", "[keyword2]", "[keyword3]"], "maxPagesPerQuery": 2, "countryCode": "US", "languageCode": "en", "mobileResults": false }

**REST API fallback:**
```bash
curl -X POST \
  "https://api.apify.com/v2/acts/apidojo~google-search-scraper/runs?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "queries": ["[keyword1]", "[keyword2]"],
    "maxPagesPerQuery": 2,
    "countryCode": "US",
    "languageCode": "en"
  }'
node scripts/run_actor.js
--actor "apidojo~google-search-scraper"
--input '{"param": "value"}'
--output YYYY-MM-DD_results.json --format json
> 必须在环境变量或`.env`文件中设置`APIFY_TOKEN`。

**如果Apify MCP可用:**
Tool: apify:run-actor Actor: "apidojo~google-search-scraper" Input: { "queries": ["[keyword1]", "[keyword2]", "[keyword3]"], "maxPagesPerQuery": 2, "countryCode": "US", "languageCode": "en", "mobileResults": false }

**REST API备选方案:**
```bash
curl -X POST \
  "https://api.apify.com/v2/acts/apidojo~google-search-scraper/runs?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "queries": ["[keyword1]", "[keyword2]"],
    "maxPagesPerQuery": 2,
    "countryCode": "US",
    "languageCode": "en"
  }'

Step 3: Parse SERP Data

步骤3:解析SERP数据

From dataset, for each keyword extract:
  • Organic results:
    position
    ,
    url
    ,
    title
    ,
    description
    ,
    displayedUrl
  • SERP features:
    featuredSnippet
    ,
    peopleAlsoAsk
    ,
    localPack
    ,
    ads
    ,
    relatedSearches
  • Total organic results count
If tracking a specific domain: find all positions where
url
contains the target domain.
从数据集中,为每个关键词提取:
  • 自然搜索结果:
    position
    url
    title
    description
    displayedUrl
  • SERP功能:
    featuredSnippet
    peopleAlsoAsk
    localPack
    ads
    relatedSearches
  • 自然搜索结果总数
如果跟踪特定域名:找出所有
url
包含目标域名的位置。

Step 4: Map Rankings

步骤4:映射排名

For each keyword, build the position table. Calculate:
  • Average position across all keywords (for a specific domain)
  • Keywords where target domain appears in top 3 / top 10 / not at all
  • Keywords owned by the same competitor (URL domain appears multiple times)
为每个关键词构建位置表格,计算:
  • (特定域名)在所有关键词中的平均排名
  • 目标域名进入前3/前10/未上榜的关键词
  • 同一竞争对手拥有的关键词(URL域名多次出现)

Step 5: Format Report

步骤5:格式化报告

Output Format

输出格式

undefined
undefined

Google SERP Ranking Report

Google SERP Ranking Report

Keywords analyzed: [N] | Country: [US] | Device: [Desktop] | Date: [DATE]
Keywords analyzed: [N] | Country: [US] | Device: [Desktop] | Date: [DATE]

Rankings Summary (for [target domain], if specified)

Rankings Summary (for [target domain], if specified)

  • Keywords in top 3: [N]
  • Keywords in top 10: [N]
  • Keywords on page 2: [N]
  • Keywords not ranking: [N]
  • Keywords in top 3: [N]
  • Keywords in top 10: [N]
  • Keywords on page 2: [N]
  • Keywords not ranking: [N]

Keyword-by-Keyword Results

Keyword-by-Keyword Results

"[keyword1]"

"[keyword1]"

PositionURLTitleType
1[url][title]Organic
2[url][title]Organic
Featured Snippet: "[snippet text excerpt]"Feature
People Also Ask: [N] questionsFeature
[pos][your domain][title]YOUR RANKING
SERP features present: [Featured Snippet / PAA / Local Pack / Ads] Ranking difficulty signal: [Easy / Medium / Hard — based on DR of top results if available]
PositionURLTitleType
1[url][title]Organic
2[url][title]Organic
Featured Snippet: "[snippet text excerpt]"Feature
People Also Ask: [N] questionsFeature
[pos][your domain][title]YOUR RANKING
SERP features present: [Featured Snippet / PAA / Local Pack / Ads] Ranking difficulty signal: [Easy / Medium / Hard — based on DR of top results if available]

"[keyword2]"

"[keyword2]"

[same structure]
[same structure]

Competitor Dominance Analysis

Competitor Dominance Analysis

DomainKeywords Where They Rank Top 3Avg Position
[domain][N][X.X]
DomainKeywords Where They Rank Top 3Avg Position
[domain][N][X.X]

SERP Feature Opportunities

SERP Feature Opportunities

Keywords where a featured snippet exists but [your domain] is not the source:
  • "[keyword]" — snippet currently owned by [domain]
  • "[keyword]" — snippet currently owned by [domain]
undefined
Keywords where a featured snippet exists but [your domain] is not the source:
  • "[keyword]" — snippet currently owned by [domain]
  • "[keyword]" — snippet currently owned by [domain]
undefined

Troubleshooting

故障排除

Results vary between runs: Google personalizes results and rotates positions. Run at the same time of day and same location for consistent tracking. No results for a keyword: Very low-volume keywords may return limited results. Try broader variations. Ad-heavy SERPs: Some keywords are dominated by ads — organic position 1 may appear lower on the page. Note this in the report.
多次运行结果不一致: Google会对结果进行个性化处理并调整排名。为保证跟踪一致性,请在同一时间、同一地点运行。 某关键词无结果: 搜索量极低的关键词可能返回有限结果。尝试使用更宽泛的变体词。 广告密集的SERP: 部分关键词的搜索结果被广告主导——自然搜索第1名可能在页面下方显示。请在报告中注明此情况。