Skip to content

Google Ads 搜索实时高级接口

GET /v3/serp/google/ads_search/locations

本接口使用 POST 方法,路径为:

/v3/serp/google/ads_search/live/advanced

Google Ads 搜索接口用于获取广告主在 Google Ads 上投放的广告信息。数据基于广告透明度平台信息,并经过整理后返回。本接口支持按指定地点、广告主、广告平台、广告格式及时间范围查询广告数据。

历史数据最早可追溯至 2018-05-31

> 注意:每个 SERP 最多返回 40 条结果,并按每个 SERP 计费。单次 Live SERP 请求只能提交一个任务;平台限流以认证说明中的 30/60/120 次/分钟规则为准。

计费说明

  • 每个请求单独计费。
  • 默认解析深度为 40;当 depth过 40 且搜索引擎返回 40 条结果时,可能产生额外费用。
  • 设置 priority=2(高优级)会产生额外费用。
  • 参考价约 ¥0.0144 / 次,价格以账户及返回结果为准。
  • 实扣费以响应头 X-SeerMarTech-Charge-CNY 为准。

所有请求体使用 UTF-8 编码的 JSON 数组格式:

json
[
  {
    "location_code": 2840,
    "platform": "google_search",
    "advertiser_ids": [
      "AR13752565271262920705",
      "AR02439908557932462081"
    ]
  }
]

请求参数

主要参数

参数类型说明
location_codeinteger搜索引擎地点代码。使用此参数后,无需再指定 location_namelocation_coordinate。可通过 /v3/serp/google/ads_search/locations 获取可用地点代码。示例:2840。如果未指定地点参数,则会在所有可用地点中搜索广告。
depthinteger解析深度,即 SERP 结果数量。默认值为 40,最大值为 120。每 40 条结果为一个计费单位, 40 可能产生额外费用。
targetstring条件填广告主的域名。当未指定 advertiser_ids 时填。
advertiser_idsarray条件填广告主标识符。当未指定 target 时填,最多可传 25 个值。广告主标识符可通过 Google Ads 广告主接口获取。
priorityinteger任务优级:1 表示普通优级(默认),2 表示高优级。高优级任务会产生额外费用。

targetadvertiser_ids 至少需要指定一个。

附加参数

参数类型说明
location_namestring搜索引擎地点的完整名称。使用此参数后,无需指定 location_codelocation_coordinate。示例:London,England,United Kingdom。如果未指定地点参数,则会在所有可用地点中搜索广告。
location_coordinatestring地点 GPS 坐标,格式为 纬度,经度。示例:52.6178549,-155.352142。使用此参数后,无需指定 location_namelocation_code
tagstring用户自定义任务标识,最长 255 个字符。该值会原样出现在响应的 data 对象中,可用于请求和结果。
platformstring广告投放平台。可选值:allgoogle_playgoogle_mapsgoogle_searchgoogle_shoppingyoutube。默认值:all
formatstring广告格式。可选值:alltextimagevideo
date_fromstring条件填查询时间范围的开始日期。指定 date_to 时填。格式:yyyy-mm-dd,最早为 2018-05-31,最晚为当前日期。
date_tostring条件填查询时间范围的结束日期。指定 date_from 时填。格式:yyyy-mm-dd,最早为 2018-05-31,最晚为当前日期。

location_codelocation_namelocation_coordinate 用于指定查询地点,三最多使用一个。

请求示例

curl

bash
curl --location --request POST \
  "https://api.seermartech.cn/v3/serp/google/ads_search/live/advanced" \
  --header "Authorization: Bearer smt_live_YOUR_KEY" \
  --header "Content-Type: application/json" \
  --data-raw '[
    {
      "location_code": 2840,
      "platform": "google_search",
      "advertiser_ids": [
        "AR13752565271262920705",
        "AR02439908557932462081"
      ]
    }
  ]'

Python

python
import requests

url = "https://api.seermartech.cn/v3/serp/google/ads_search/live/advanced"

headers = {
    "Authorization": "Bearer smt_live_YOUR_KEY",
    "Content-Type": "application/json",
}

payload = [
    {
        "location_code": 2840,
        "platform": "google_search",
        "advertiser_ids": [
            "AR13752565271262920705",
            "AR02439908557932462081",
        ],
    }
]

response = requests.post(url, headers=headers, json=payload)
result = response.json()

if result.get("status_code") == 20000:
    print(result)
else:
    print(
        f"请求失败:{result.get('status_code')} "
        f"{result.get('status_message')}"
    )

TypeScript

typescript
import axios from "axios";

const response = await axios.post(
  "https://api.seermartech.cn/v3/serp/google/ads_search/live/advanced",
  [
    {
      location_code: 2840,
      platform: "google_search",
      advertiser_ids: [
        "AR13752565271262920705",
        "AR02439908557932462081",
      ],
    },
  ],
  {
    headers: {
      Authorization: "Bearer smt_live_YOUR_KEY",
      "Content-Type": "application/json",
    },
  }
);

const result = response.data;

if (result.status_code === 20000) {
  console.log(result);
} else {
  console.error(
    `请求失败:${result.status_code} ${result.status_message}`
  );
}

响应结构

接口返回 JSON 数据,主要结构如下:

json
{
  "version": "0.1.20241203",
  "status_code": 20000,
  "status_message": "Ok.",
  "time": "9.1262 sec.",
  "cost": 0.002,
  "tasks_count": 1,
  "tasks_error": 0,
  "tasks": [
    {
      "id": "00000000-0000-0000-0000-000000000000",
      "status_code": 20000,
      "status_message": "Ok.",
      "time": "9.1262 sec.",
      "cost": 0.002,
      "result_count": 1,
      "path": [
        "v3",
        "serp",
        "google",
        "ads_search",
        "live",
        "advanced"
      ],
      "data": {
        "api": "serp",
        "function": "live",
        "se": "google",
        "se_type": "ads_search",
        "location_code": 2840,
        "platform": "google_search",
        "advertiser_ids": [
          "AR13752565271262920705",
          "AR02439908557932462081"
        ],
        "device": "desktop",
        "os": "windows"
      },
      "result": [
        {
          "se_results_count": 0,
          "items_count": 37,
          "items": []
        }
      ]
    }
  ]
}

顶层字段

字段类型说明
versionstring当前 API 版本。
status_codeinteger请求总体状态码。成功通常为 20000。完整错误码请参考错误码文档。
status_messagestring请求总体状态信息。
timestring请求执行耗时,单位为秒。
costfloat平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。
tasks_countintegertasks 数组中的任务总数。
tasks_errorinteger返回错误的任务数量。
tasksarray任务结果数组。

tasks 任务字段

字段类型说明
idstring任务唯一标识,UUID 格式。
status_codeinteger任务状态码,通常在 1000060000 范围。
status_messagestring任务状态信息。
timestring任务执行耗时,单位为秒。
costfloat平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。
result_countintegerresult 数组中的数量。
patharray请求 API 的路径片段。
dataobject请求中提交的参数。
resultarraySERP 查询结果数组。

result 结果字段

字段类型说明
keywordstring请求中的。返回时会对编码进行解码,+ 会被解码为空格。
typestring搜索引擎结果类型。
se_domainstring搜索引擎域名。
location_codeinteger地点代码。
language_codestring语言代码。
check_urlstring | null搜索引擎结果页的直接 URL。本接口通常为 null
datetimestring获取结果的日期和时间,采用 UTC 格式:yyyy-mm-dd hh-mm-ss +00:00
spellobject | null搜索引擎自动纠错信息。如果被纠正,则返回纠正后的及纠错类型;无纠错时为 null
refinement_chipsobject搜索细化选项。
item_typesarraySERP 中的结果类型。本接口可能 ads_search
se_results_countintegerSERP 中的结果总数。
items_countintegeritems 数组中返回的结果数量。
itemsarraySERP 结果数组。

refinement_chips

字段类型说明
typestring固定为 refinement_chips
xpathstring素在页面中的 XPath。
itemsarray搜索细化列表。

refinement_chips.items 中的字段:

字段类型说明
typestring固定为 refinement_chips_element
titlestring细化选项标题。
urlstring携带细化参数的搜索 URL。
domainstringSERP 中的域名。
optionsarray进一步的搜索细化选项。

options 中的字段:

字段类型说明
typestring固定为 refinement_chips_option
titlestring细化选项标题。
urlstring携带细化参数的搜索 URL。
domainstringSERP 中的域名。

ads_search 广告结果字段

items 中的类型为 ads_search 时,返回以下字段:

字段类型说明
typestring固定为 ads_search
rank_groupinteger分组排名。在相同 type素组成的分组中的位置;不同类型之间的位置不会计此字段。
rank_absoluteintegerSERP 中的绝对排名,即在所有结果中的位置。
advertiser_idstring广告账户唯一标识符。
creative_idstring广告创意唯一标识符。
titlestring广告标题,通常广告主名称。
urlstring广告 URL,指向广告透明度平台中的广告。
verifiedboolean广告账户是否经过验证。Google Ads 已验证账户时为 true
formatstring广告格式。可选值:textimagevideo
preview_imagearray广告预览图信息。
preview_urlstring指向广告预览页面的 URL。
first_shownstring广告首次展示时间,采用 UTC 格式:yyyy-mm-dd hh-mm-ss +00:00
last_shownstring广告最近一次展示时间,采用 UTC 格式:yyyy-mm-dd hh-mm-ss +00:00

preview_image 字段

字段类型说明
urlstring预览图 URL。
heightinteger预览图高度。
widthinteger预览图宽度。

状态码与错误处理

请根据以下字段判断请求及任务是否成功:

  • 顶层 status_code
  • 任务级 tasks[].status_code
  • 对应的 status_message

建议在客户端实现错误重试、参数校验、时处理及部分任务失败处理。完整状态码列表请参考错误码文档。

实用场景

  • 监测竞品广告主:按 advertiser_ids 获取竞品在不同地区和平台投放的广告,分析广告素材、投放时间及覆盖范围。
  • 追踪品牌广告:按 target 和地点查询指定域名的广告,评估品牌在目标市场中的广告可见度。
  • 分析广告素材变化:结合 formatfirst_shownlast_shown 字段,识别文本、图片及视频广告的上线周期和更新频率。
  • 构建地区广告报库:使用 location_codelocation_coordinate 获取不同城市的广告结果,为区域市场策略和本地化 SEO 提供依据。
  • 评估广告平台投放组合:通过 platform 区分 Google 搜索、购物、地图、应用商店和 YouTube 广告,比较竞品在各渠道的投放重点。

统一入口:官网 · LLM API · 控制台