主题
根据任务 ID 获取 Google 站点结果
本接口:GET /v3/keywords_data/google/keywords_for_site/task_get/$id
Google AdWords 数据接口属于旧版接口,建议迁移至 Google Ads API。
本接口用于获取指定网站的,并返回以下数据:
- 及分类
- 最近一个月的搜索量
- 最近 12 个月的搜索量趋势
- 平均每次点击费用(CPC)
- 付费搜索竞争程度
- 地域和语言信息
单个任务最多可返回 700 个建议及核心数据。
> Google AdWords API 返回的数据可能与规划师界面中的估算值不同。搜索结果可能受到广告账户历史、已有广告素材、定向设置及账户因素影响。
请求信息
请求方法
GET
请求 URL
text
https://api.seermartech.cn/v3/keywords_data/google/keywords_for_site/task_get/$id将 $id 替换为任务 ID。
请求头
http
Authorization: Bearer smt_live_YOUR_KEY
Content-Type: application/json计费说明
- 在创建任务时计费。
- 创建任务后 30 天,可获取该任务结果。
- 实扣费以响应头
X-SeerMarTech-Charge-CNY为准。
请求参数
接口通过 URL 路径接收任务 ID,无需请求体。
| 参数 | 类型 | 说明 |
|---|---|---|
id | string | 任务唯一标识,UUID 格式。任务创建后 30 天可使用该 ID 随时获取结果。 |
响应说明
接口返回 JSON 数据 tasks 数组。
顶层字段
| 字段 | 类型 | 说明 |
|---|---|---|
version | string | 当前 API 版本。 |
status_code | integer | 请求级状态码。 |
status_message | string | 请求级状态说明。 |
time | string | 请求执行耗时,单位为秒。 |
cost | float | 平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。 |
tasks_count | integer | tasks 数组中的任务数量。 |
tasks_error | integer | tasks 数组中返回错误的任务数量。 |
tasks | array | 任务结果数组。 |
tasks 中的任务字段
| 字段 | 类型 | 说明 |
|---|---|---|
id | string | 任务唯一标识,UUID 格式。 |
status_code | integer | 任务状态码,通常为 10000–60000。 |
status_message | string | 任务状态说明。 |
time | string | 任务执行耗时,单位为秒。 |
cost | float | 平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。 |
result_count | integer | result 数组中的结果数量。 |
path | array | 请求 URL 路径。 |
data | object | 创建任务时提交的参数。 |
result | array | 结果数组。 |
当任务尚未完成、执行失败或没有可用数据时,result 可能为 null。
data 字段
data 中创建任务时提交的主要参数,例如:
| 字段 | 类型 | 说明 |
|---|---|---|
api | string | API 模块名称。 |
function | string | 接口功能名称。 |
se | string | 搜索引擎名称。 |
location_name | string | 地域名称。 |
language_name | string | 语言名称。 |
target | string | 目标网站或域名。 |
tag | string | 用户自定义任务标签。 |
result 数组中的字段
| 字段 | 类型 | 说明 |
|---|---|---|
keyword | string | 。 |
location_code | integer | 地域代码。无数据时为 null。 |
language_code | string | 语言代码。无数据时为 null。 |
search_partners | boolean | 是否搜索合作伙伴网络的数据。 |
competition | float | 付费搜索竞争程度,取值范围为 0–1。该值基于广告数据计算,无数据时为 null。 |
cpc | float | 历史平均每次点击费用。原始数据以计价,无数据时为 null。 |
search_volume | integer | 月均搜索量,表示指定地域下该的大致月均搜索次数。无数据时为 null。 |
categories | array | 产品和服务分类。无数据时为 null。 |
monthly_searches | array | 最近 12 个月的月度搜索量数据。无数据时为 null。 |
monthly_searches 数组字段
| 字段 | 类型 | 说明 |
|---|---|---|
year | integer | 年份。 |
month | integer | 月份。 |
search_volume | integer | 该月份的搜索量。 |
请求示例
cURL
bash
task_id="02031614-0696-0108-0000-b26a2a6c7e17"
curl --location --request GET \
"https://api.seermartech.cn/v3/keywords_data/google/keywords_for_site/task_get/${task_id}" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json"TypeScript
typescript
import axios from "axios";
const taskId = "02231934-2604-0066-2000-570459f04879";
axios
.get(
`https://api.seermartech.cn/v3/keywords_data/google/keywords_for_site/task_get/${taskId}`,
{
headers: {
Authorization: "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
},
}
)
.then((response) => {
// 处理接口返回结果
console.log(response.data);
})
.catch((error) => {
console.error("请求失败:", error.response?.data || error.message);
});Python
python
import requests
task_id = "02031614-0696-0108-0000-b26a2a6c7e17"
url = (
"https://api.seermartech.cn/v3/keywords_data/google/"
f"keywords_for_site/task_get/{task_id}"
)
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
}
response = requests.get(url, headers=headers, timeout=30)
response.raise_for_status()
data = response.json()
if data.get("status_code") == 20000:
for task in data.get("tasks", []):
if task.get("status_code", 0) >= 40000:
print(
f"任务失败:{task.get('status_code')} "
f"{task.get('status_message')}"
)
else:
for item in task.get("result") or []:
print(
item.get("keyword"),
item.get("search_volume"),
item.get("competition"),
item.get("cpc"),
)
else:
print(
f"请求失败:{data.get('status_code')} "
f"{data.get('status_message')}"
)响应示例
json
{
"version": "0.1.20200130",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.1233 sec.",
"cost": 0,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"id": "02031614-0696-0108-0000-b26a2a6c7e17",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.0987 sec.",
"cost": 0,
"result_count": 2,
"path": [
"v3",
"keywords_data",
"google",
"keywords_for_site",
"task_get",
"02031614-0696-0108-0000-b26a2a6c7e17"
],
"data": {
"api": "keywords_data",
"function": "keywords_for_site",
"se": "google",
"location_name": "United States",
"language_name": "English",
"target": "example.com",
"tag": "tag1"
},
"result": [
{
"keyword": "average page rpm adsense",
"location_code": 2840,
"language_code": "en",
"search_partners": false,
"competition": 0.10714285714285714,
"cpc": 14.81844,
"search_volume": 10,
"categories": null,
"monthly_searches": [
{
"year": 2024,
"month": 12,
"search_volume": 10
}
]
},
{
"keyword": "adsense blank ads how long",
"location_code": 2840,
"language_code": "en",
"search_partners": false,
"competition": 0.047619047619047616,
"cpc": 0,
"search_volume": 10,
"categories": null,
"monthly_searches": [
{
"year": 2024,
"month": 12,
"search_volume": 10
}
]
}
]
}
]
}状态码与异常处理
建议对请求级和任务级状态码分别进行判断:
status_code = 20000:请求或任务成功。status_code >= 40000:任务执行失败或返回异常。- 当
result为null或result_count = 0时,表示当前任务没有可用结果。 - 生产环境应记录
status_code、status_message、任务 ID 和请求时间,以便重试和排查问题。
实用场景
- 挖掘竞品网站:获取目标域名的、搜索量和竞争程度,支持竞品 SEO 词库分析。
- 筛选选题:结合月均搜索量与 12 个月趋势,优选择稳定或增长潜力的。
- 评估商业价值:通过 CPC 和付费竞争程度识别高商业意图,和落地页规划。
- 构建地域化词库:按地域代码和语言返回数据,支持多国家、多语言 SEO 项目。
- 监控需求变化:定期获取月度搜索量,分析季节性波动并调整发布节奏。