Skip to content

Google Ads 按获取广告流量预测(实时)

POST /v3/keywords_data/google_ads/ad_traffic_by_keywords/live

接口说明

POST /v3/keywords_data/google_ads/ad_traffic_by_keywords/live

本接口用于根据、出价、匹类型、地域、语言和预测时间范围,获取 Google Ads 广告流量预测数据平均每次点击费用、预计点击次数和广告费用等指标。相比常规搜索量数据,本接口更适合评估特定的广告需求。

返回结果与 Google Ads 账户的历史广告数据、账户中已有的广告素材及因素。建议设置较高的 bid,以降低账户历史因素对预测结果的影响。

> 自 6 月 1 日起,本接口返回整个广告系列的批量数据,即返回任务中指定的数据。

调用限制

  • 每个 Google Ads 账户通过 Live 接口每分钟最多发送 12 个请求。
  • 每个 Live 请求只能 1 个任务。
  • keywords 数组最多 1000 个。
  • 无论一次请求 1 个还是 1000 个,均按请求计费。
  • 所有 POST 请求使用 UTF-8 编码的 JSON 格式。

预测时间范围

可以通过以下两种方式指定预测时间范围:

  1. 使用 date_fromdate_to 指定确切的未来日期;
  2. 使用 date_interval 指定预设时间范围:
    • next_week:下周
    • next_month:下月
    • next_quarter:下季度

如果未指定上述任一方式,默认使用 next_month

计费说明

每次请求都会产生费用。扣费以响应头 X-SeerMarTech-Charge-CNY 为准。

请求参数

请求体是 JSON 数组,且每个 Live 请求只能一个任务对象。

参数类型说明
keywordsarray要查询的数组。最多 1000 个;每个最多 80 个字符、最多 10 个单词。会被转换为小写格式。部分组合可能没有可用数据。Google Ads 不支持部分特殊符号、Unicode 符号和表符号。
bidinteger最大自定义出价,表示愿意为广告点击支付的最高金额。出价越高,返回的预测指标和费用通常越高。
matchstring匹类型。可选值:exactbroadphrase
location_namestring搜索引擎地域的完整名称,例如 London,England,United Kingdom。未指定时返回范围结果。使用此参数后,无需同时指定 location_codelocation_coordinate
location_codeinteger搜索引擎地域代码,例如 2840。未指定时返回范围结果。使用此参数后,无需同时指定 location_namelocation_coordinate
location_coordinatestring地域 GPS 坐标,格式为 "纬度,经度",例如 52.6178549,-155.352142。返回结果将基于该坐标所属国家。使用此参数后,无需同时指定 location_namelocation_code
language_namestring搜索引擎语言名称,例如 English
language_codestring搜索引擎语言代码,例如 en
date_fromstring条件填预测时间范围的开始日期。指定 date_to 时同时指定。格式为 yyyy-mm-dd,最早可设置为明天。date_from 不得晚于 date_to。指定该参数和 date_to 后,无需指定 date_interval
date_tostring条件填预测时间范围的结束日期。指定 date_from 时同时指定。最早可设置为 date_from 后一天,最晚可设置为当前日期对应月份的下一年。格式为 yyyy-mm-dd
date_intervalstring预设预测时间范围。可选值:next_weeknext_monthnext_quarter。默认值为 next_month。指定该参数后,无需指定 date_fromdate_to
sort_bystring结果排序字段,按降序排列。可选值:relevanceimpressionsctraverage_cpccostclicks。默认值为 relevance
tagstring用户自定义任务标识,最多 255 个字符。该值会原样返回在响应任务的 data 对象中,可用于请求与结果。

地域和语言

可通过以下接口获取可用地域和语言:

  • 地域列表:GET /v3/keywords_data/google_ads/locations
  • 语言列表:GET /v3/keywords_data/google_ads/languages

日期参数补说明

如果 Google Ads 状态接口 /v3/keywords_data/google_ads/status 返回的 actual_data 为:

  • falsedate_from 可以设置为前两个月及更早时间;
  • truedate_from 可以设置为上个月及更早时间。

请求示例

curl

bash
curl --location --request POST \
  "https://api.seermartech.cn/v3/keywords_data/google_ads/ad_traffic_by_keywords/live" \
  --header "Authorization: Bearer smt_live_YOUR_KEY" \
  --header "Content-Type: application/json" \
  --data-raw '[
    {
      "location_name": "United States",
      "language_name": "English",
      "bid": 999,
      "match": "exact",
      "keywords": [
        "seo marketing"
      ],
      "date_interval": "next_month",
      "sort_by": "relevance",
      "tag": "seo-forecast-demo"
    }
  ]'

Python

python
import requests

url = "https://api.seermartech.cn/v3/keywords_data/google_ads/ad_traffic_by_keywords/live"

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

# POST 请求体是 JSON 数组
payload = [
    {
        "location_name": "United States",
        "language_name": "English",
        "bid": 999,
        "match": "exact",
        "keywords": ["seo marketing"],
        "date_interval": "next_month",
    }
]

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

result = response.json()

if result.get("status_code") == 20000:
    print(result)
else:
    print(
        "请求失败,错误码:%s,错误信息:%s"
        % (result.get("status_code"), result.get("status_message"))
    )

TypeScript

typescript
import axios from "axios";

const payload = [
  {
    location_name: "United States",
    language_name: "English",
    bid: 999,
    match: "exact",
    keywords: ["seo marketing"],
    date_interval: "next_month",
  },
];

axios
  .post(
    "https://api.seermartech.cn/v3/keywords_data/google_ads/ad_traffic_by_keywords/live",
    payload,
    {
      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);
  });

响应结构

服务端返回 JSON 数据,核心结果位于 tasks 数组中。

顶层字段

字段类型说明
versionstring当前 API 版本。
status_codeinteger请求级状态码。20000 表示成功。完整状态码请参考错误码文档。
status_messagestring请求级状态说明。
timestring请求执行耗时,例如 3.5834 sec.
costfloat平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。
tasks_countintegertasks 数组中的任务数量。
tasks_errorintegertasks 数组中返回错误的任务数量。
tasksarray任务结果数组。

tasks 任务字段

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

result 结果字段

字段类型说明
keywordstring请求中的。
location_codeinteger / null请求中的地域代码。没有数据时为 null
language_codestring / null请求中的语言代码。没有数据时为 null
date_intervalstring请求中的预测时间范围。
search_partnersboolean是否 Google 搜索合作伙伴。该参数已废弃,返回值始终为 false
bidinteger创建任务时设置的最大自定义出价。出价越高,预测指标和费用可能越高。
matchstring匹类型,可为 exactbroadphrase
impressionsfloat / null预测广告展示次数。该字段已废弃,返回值始终为 null
ctrfloat / null预测广告点击率,即预测点击次数除以广告展示次数。该字段已废弃,返回值始终为 null
average_cpcfloat / null预测平均每次点击费用,根据指定时间范围和历史数据计算。没有数据时为 null
costfloat / null在指定时间范围投放广告的预测费用。没有数据时为 null
clicksfloat / null在指定时间范围的预测广告点击次数。没有数据时为 null

响应示例

json
{
  "version": "0.1.20221214",
  "status_code": 20000,
  "status_message": "Ok.",
  "time": "3.5834 sec.",
  "cost": 0.075,
  "tasks_count": 1,
  "tasks_error": 0,
  "tasks": [
    {
      "id": "01234567-89ab-cdef-0123-456789abcdef",
      "status_code": 20000,
      "status_message": "Ok.",
      "time": "3.1000 sec.",
      "cost": 0.075,
      "result_count": 1,
      "path": [
        "v3",
        "keywords_data",
        "google_ads",
        "ad_traffic_by_keywords",
        "live"
      ],
      "data": {
        "api": "keywords_data",
        "function": "ad_traffic_by_keywords",
        "se": "google_ads",
        "language_code": "en",
        "location_code": 2840,
        "bid": 999,
        "match": "exact",
        "keywords": [
          "seo marketing"
        ],
        "date_interval": "next_month"
      },
      "result": [
        {
          "keyword": "seo marketing",
          "location_code": 2840,
          "language_code": "en",
          "date_interval": "next_month",
          "search_partners": false,
          "bid": 999,
          "match": "exact",
          "impressions": null,
          "ctr": null,
          "average_cpc": 4.25,
          "cost": 425.0,
          "clicks": 100.0
        }
      ]
    }
  ]
}

状态码与错误处理

建议根据顶层 status_code 和任务级 status_code 分别处理请求状态与任务状态:

  • 20000:请求或任务成功。
  • 20000:请求或任务处理失败,应结合 status_message 定位原因。
  • tasks_error 大于 0 时,表示至少有一个任务返回错误。

完整错误码请参考:/v3/appendix/errors

实用场景

  • 评估广告需求:根据指定出价和预测周期获取点击量、平均 CPC 与广告费用,判断是否值得投放。
  • 制定 SEO 与 SEM优级:对同一主题下的进行广告流量预测,优建设搜索需求和商业价值的页面。
  • 比较匹策略:分别使用 exactphrasebroad 获取预测结果,评估不同匹类型对点击量与成本的影响。
  • 规划区域化投放预算:按国家、城市或坐标查询广告预测数据,为本地 SEO 和区域广告活动分预算。
  • 预测季度营销流量:使用 next_weeknext_monthnext_quarter 获取未来周期数据,支持营销排期和预算规划。

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