google-ads

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Google Ads

Google Ads

<!-- BEGIN:skill-intro -->
Tools for working with a Google Ads account against the Google Ads API (
https://googleads.googleapis.com/v23/
). Reads are expressed in GAQL (Google Ads Query Language) against the search endpoint; writes go through the per-resource mutate endpoints. 13 tools across account navigation, reads and reporting, and campaign / budget / conversion-tracking management. Google Ads organizes accounts as a hierarchy: a manager (MCC) account can operate client accounts beneath it. Most tools take the operating account's
customerId
, plus an optional
loginCustomerId
(the manager account) when the operating account is reached through a manager.
<!-- legal:disclaimer -->
Independent, unofficial connector for Google Ads. Not affiliated with, endorsed by, or sponsored by Google Ads. "Google Ads" is a trademark of its owner, used only to identify the service this connector works with.
<!-- /legal:disclaimer --> <!-- END:skill-intro -->
<!-- BEGIN:skill-intro -->
用于通过Google Ads API
https://googleads.googleapis.com/v23/
)操作Google Ads账户的工具。读取操作通过搜索端点以GAQL(Google Ads查询语言)实现;写入操作通过各资源对应的mutate端点完成。涵盖账户导航、读取与报表、广告系列/预算/转化跟踪管理三大类,共13个工具。Google Ads采用层级化账户结构:管理型(MCC)账户可操作其下的客户账户。大多数工具需要传入操作账户的
customerId
,若通过管理型账户访问操作账户,还可传入可选的
loginCustomerId
(即管理型账户ID)。
<!-- legal:disclaimer -->
独立、非官方的Google Ads连接器。与Google Ads无关联、未获其认可或赞助。"Google Ads"为其所有者的商标,仅用于标识本连接器所适配的服务。
<!-- /legal:disclaimer --> <!-- END:skill-intro -->

When to use this

适用场景

<!-- BEGIN:skill-use-cases -->
  • Resolve which account to act on — list the accounts the connection can access, then (when access is through a manager) the client accounts beneath it.
  • Read campaigns, ad groups, and ads — list them with status and budget, or run an arbitrary GAQL query for anything the structured reads don't cover.
  • Build performance reports — pick a resource, the metrics to measure, and a date range.
  • Manage campaigns and budgets — pause, enable, or remove a campaign; create or adjust a daily budget.
  • Set up conversion tracking — list or create conversion actions (including the offline-conversion
    UPLOAD_CLICKS
    action).
<!-- END:skill-use-cases -->
<!-- BEGIN:skill-use-cases -->
  • 确定操作的账户——列出连接可访问的账户,若通过管理型账户访问,还可列出其下的客户账户。
  • 读取广告系列、广告组和广告——列出包含状态与预算的相关信息,或运行任意GAQL查询以覆盖结构化读取未涵盖的内容。
  • 构建绩效报表——选择资源、要衡量的指标以及日期范围。
  • 管理广告系列与预算——暂停、启用或删除广告系列;创建或调整每日预算。
  • 设置转化跟踪——列出或创建转化操作(包括线下转化的
    UPLOAD_CLICKS
    操作)。
<!-- END:skill-use-cases -->

Setup

安装配置

This is an agentskills.io skill.
If the connector has not been installed as a skill yet, install it first with
npx skills add zapier/connectors --skill google-ads
(or your harness's own skill-install mechanism), then continue here. Installing the skill copies these files, not dependencies. Before running the CLI, a local MCP server, or
zapier-sdk
auth commands, run
npm install --omit=dev
here once. Importing the published package as a dependency in your own project instead? That
npm install
already resolves everything — see
references/use-as-sdk.md
.
The connector runs on Node.js 22.18+. Pick the reference that matches how you're running it, and load it before doing anything else:
You have...Load
An MCP-aware client — tools may already be loaded (e.g.
mcp__google-ads__<tool>
), or you can register a local server yourself (or guide the user to)
references/use-as-mcp.md
Terminal / subprocess access (you can run
node
)
references/use-as-cli.md
Only your own code, importing this package as a dependency
references/use-as-sdk.md
No tool access, no terminal, no ability to import this package — you write your own code that calls the Google Ads API directly (e.g. a code-execution sandbox)
references/use-as-recipe.md
这是一个agentskills.io技能。
如果尚未将该连接器作为技能安装,请先执行
npx skills add zapier/connectors --skill google-ads
(或使用你的Harness自带的技能安装机制)进行安装,然后继续以下步骤。安装技能仅会复制这些文件,不会安装依赖项。运行CLI、本地MCP服务器或
zapier-sdk
认证命令前,请在此处执行一次
npm install --omit=dev
。若要在你自己的项目中导入已发布的包作为依赖?此时
npm install
已解决所有依赖问题——请参阅
references/use-as-sdk.md
该连接器运行于**Node.js 22.18+**环境。请选择与你的运行方式匹配的参考文档,并在操作前加载它:
你拥有...加载方式
支持MCP的客户端——工具可能已加载(例如
mcp__google-ads__<tool>
),你也可以自行注册本地服务器(或引导用户注册)
references/use-as-mcp.md
终端/子进程访问权限(可运行
node
命令)
references/use-as-cli.md
仅能使用自有代码,将本包作为依赖导入
references/use-as-sdk.md
无工具访问权限、无终端、无法导入本包——需自行编写调用Google Ads API的代码(例如在代码执行沙箱中)
references/use-as-recipe.md

Scripts

脚本说明

<!-- BEGIN:skill-connections-note? -->
All scripts use the single connection
google-ads
. Customer-scoped scripts take the operating account's
customerId
(digits only) and an optional
loginCustomerId
(the manager account, when access is through a manager).
<!-- END:skill-connections-note --> <!-- BEGIN:skill-scripts-table -->
ScriptScript nameConnectionsDescription
scripts/listAccessibleCustomers.ts
listAccessibleCustomers
google-ads
List the accounts the connection can directly access (the account-resolution entry point).
scripts/listCustomerClients.ts
listCustomerClients
google-ads
List the client (operating) accounts beneath a manager account.
scripts/search.ts
search
google-ads
Run an arbitrary GAQL query — the full read surface.
scripts/listSearchableFields.ts
listSearchableFields
google-ads
List the selectable / filterable / sortable fields for a resource (compose a
search
query).
scripts/listCampaigns.ts
listCampaigns
google-ads
List campaigns with status, channel type, budget, and dates.
scripts/listAdGroups.ts
listAdGroups
google-ads
List ad groups, optionally scoped to one campaign.
scripts/listAds.ts
listAds
google-ads
List ads, optionally scoped to one ad group.
scripts/listConversionActions.ts
listConversionActions
google-ads
List the conversion actions configured on the account.
scripts/getReport.ts
getReport
google-ads
Build a performance report: resource + metrics + segments over a date range.
scripts/setCampaignStatus.ts
setCampaignStatus
google-ads
Pause, enable, or remove a campaign.
scripts/createCampaignBudget.ts
createCampaignBudget
google-ads
Create a daily campaign budget (amount in micros).
scripts/updateCampaignBudget.ts
updateCampaignBudget
google-ads
Update an existing budget's amount, name, or delivery method.
scripts/createConversionAction.ts
createConversionAction
google-ads
Create a conversion action (e.g.
UPLOAD_CLICKS
for offline tracking).
Learn a script's input contract before calling it — never guess field names, casing, or types. Run
--help
on a script (
./scripts/<name>.ts --help
or
node cli.js run <name> --help
); it renders the
inputSchema
as JSON Schema and lists the connection flag and resolvers. Guessing the payload just produces a
ZodError
and wastes a round-trip.
<!-- END:skill-scripts-table --> <!-- BEGIN:disambiguation-and-refusals? -->
<!-- BEGIN:skill-connections-note? -->
所有脚本均使用单个连接
google-ads
。客户范围的脚本需要传入操作账户的
customerId
(仅数字),以及可选的
loginCustomerId
(当通过管理型账户访问时,即管理型账户ID)。
<!-- END:skill-connections-note --> <!-- BEGIN:skill-scripts-table -->
脚本脚本名称连接描述
scripts/listAccessibleCustomers.ts
listAccessibleCustomers
google-ads
列出连接可直接访问的账户(账户解析的入口)。
scripts/listCustomerClients.ts
listCustomerClients
google-ads
列出管理型账户下的客户(操作)账户。
scripts/search.ts
search
google-ads
运行任意GAQL查询——完整的读取功能。
scripts/listSearchableFields.ts
listSearchableFields
google-ads
列出资源的可选/可过滤/可排序字段(用于编写
search
查询)。
scripts/listCampaigns.ts
listCampaigns
google-ads
列出包含状态、渠道类型、预算和日期的广告系列。
scripts/listAdGroups.ts
listAdGroups
google-ads
列出广告组,可选择限定单个广告系列。
scripts/listAds.ts
listAds
google-ads
列出广告,可选择限定单个广告组。
scripts/listConversionActions.ts
listConversionActions
google-ads
列出账户中配置的转化操作。
scripts/getReport.ts
getReport
google-ads
构建绩效报表:资源 + 指标 + 日期范围内的细分维度。
scripts/setCampaignStatus.ts
setCampaignStatus
google-ads
暂停、启用或删除广告系列。
scripts/createCampaignBudget.ts
createCampaignBudget
google-ads
创建每日广告预算(金额以微单位表示)。
scripts/updateCampaignBudget.ts
updateCampaignBudget
google-ads
更新现有预算的金额、名称或投放方式。
scripts/createConversionAction.ts
createConversionAction
google-ads
创建转化操作(例如用于线下跟踪的
UPLOAD_CLICKS
)。
调用脚本前请先了解其输入规则——切勿猜测字段名称、大小写或类型。 对脚本执行
--help
命令(
./scripts/<name>.ts --help
node cli.js run <name> --help
);它会将
inputSchema
渲染为JSON Schema,并列出连接标志和解析器。猜测参数只会产生
ZodError
,浪费一次请求。
<!-- END:skill-scripts-table --> <!-- BEGIN:disambiguation-and-refusals? -->

Disambiguation & refusals

歧义处理与拒绝规则

  • Money is in micros. Budgets, bids, and report cost metrics (
    *_micros
    ) are 1,000,000 × the currency amount (e.g. $50.00 →
    50000000
    ). The one exception is a conversion action's default value, which is plain currency. Don't report a
    cost_micros
    of 5,000,000 as "$5,000,000".
  • Act on ids, not names. Writes (
    setCampaignStatus
    ,
    updateCampaignBudget
    ) take ids. Resolve a name to an id first with
    listCampaigns
    /
    search
    ; if two campaigns share a name, list them with a distinguishing field (id, status, channel type) and confirm which one before acting — never silently pick.
  • Unsupported — decline, don't substitute. This connector does not upload offline conversions or add members to a Customer Match audience (Google routes new API integrations to the separate Data Manager API for those), and does not create full campaigns or manage keywords / targeting / ad creatives. If asked, say it's unsupported rather than substituting another tool and reporting success.
    createConversionAction
    sets up the conversion action; it does not upload conversions.
<!-- END:disambiguation-and-refusals -->
  • 金额以微单位表示。预算、出价和报表成本指标(
    *_micros
    )为货币金额的1,000,000倍(例如:$50.00 →
    50000000
    )。唯一例外是转化操作的默认值,它以普通货币单位表示。请勿将
    cost_micros
    值5,000,000报告为"$5,000,000"。
  • 依据ID而非名称操作。写入操作(
    setCampaignStatus
    updateCampaignBudget
    )需要传入ID。请先通过
    listCampaigns
    /
    search
    将名称解析为ID;如果两个广告系列名称相同,请列出包含区分字段(ID、状态、渠道类型)的信息,并在操作前确认具体是哪一个——切勿静默选择。
  • 不支持的操作——直接拒绝,不要替代。本连接器不支持上传线下转化或向客户匹配受众添加成员(Google已将这些新API集成路由至单独的数据管理器API),也不支持创建完整的广告系列或管理关键词/定向/广告创意。如果用户提出此类请求,请告知不支持,而非使用其他工具替代并报告操作成功。
    createConversionAction
    仅用于设置转化操作,不负责上传转化数据。
<!-- END:disambiguation-and-refusals -->

Auth

认证方式

Every shape passes auth as one connection selector, not the secret — a
[<resolver>:]<value>
string. Every connector accepts
zapier:<connection-id>
(Zapier-managed auth — routes through Zapier's auth, retries, and governance layer); some also accept one or more direct-token resolvers (naming and count vary per connector) — check this connector's own resolvers rather than assuming. The
<resolver>:
prefix is optional; a bare value goes to the first resolver that claims it — a UUID-shaped bare value always claims
zapier:
. Each script declares the connections it needs and the resolvers each accepts. The exact syntax for passing a connection (and how to see this connector's resolver list) differs by shape — see the reference you loaded above.
Checking what's already configured first? Don't dump environment values to do it —
env
or
env | grep <name>
prints the value along with the name, leaking a live credential into the transcript if one is set. Check names only (
env | cut -d= -f1 | grep -i <name>
) or test a known name directly (
[ -n "$VAR_NAME" ]
).
<!-- BEGIN:skill-auth-notes? operational behavior that differs by WHICH resolver is used — a safety gate only one path enforces, scopes/permissions that differ between resolvers, a billing/plan difference tied to the auth path, or a feature only available (or unavailable) on one resolver. Not for describing how to obtain or pass a credential — that's references/use-without-zapier.md's job. Leave this region empty (unfilled) if every resolver behaves identically. --> <!-- END:skill-auth-notes -->
No connection yet? Pick one — and follow the reference's own flow to obtain it; never just ask the user for a connection id or token as if they already have one memorized:
Load
Pass the credential directly
references/use-without-zapier.md
Route it through a Zapier connection
references/use-with-zapier.md
所有操作均通过单个连接选择器传递认证信息,而非密钥——格式为
[<resolver>:]<value>
的字符串。每个连接器均接受
zapier:<connection-id>
(Zapier托管的认证——通过Zapier的认证、重试和治理层路由);部分连接器还接受一种或多种直接令牌解析器(名称和数量因连接器而异)——请查看本连接器自身的解析器列表,不要假设。
<resolver>:
前缀是可选的;无前缀的值会被第一个匹配的解析器处理——UUID格式的无前缀值始终匹配
zapier:
。每个脚本都会声明其所需的连接以及接受的解析器。传递连接的确切语法(以及查看本连接器解析器列表的方式)因运行环境而异——请参阅你之前加载的参考文档。
想要先查看已配置的内容?不要通过打印环境变量来实现——
env
env | grep <name>
会同时打印名称和值,如果设置了有效凭证,会将其泄露到日志中。请仅查看名称(
env | cut -d= -f1 | grep -i <name>
)或直接测试已知名称(
[ -n "$VAR_NAME" ]
)。
<!-- BEGIN:skill-auth-notes? operational behavior that differs by WHICH resolver is used — a safety gate only one path enforces, scopes/permissions that differ between resolvers, a billing/plan difference tied to the auth path, or a feature only available (or unavailable) on one resolver. Not for describing how to obtain or pass a credential — that's references/use-without-zapier.md's job. Leave this region empty (unfilled) if every resolver behaves identically. --> <!-- END:skill-auth-notes -->
还未配置连接?请选择以下方式之一,并按照对应参考文档的流程获取连接——切勿直接向用户索要连接ID或令牌,默认他们不会记住这些信息:
加载方式
直接传递凭证
references/use-without-zapier.md
通过Zapier连接路由
references/use-with-zapier.md

Output format

输出格式

Every script returns a
{ data, meta }
envelope:
  • data
    — the script's result (the shape its
    outputSchema
    declares; see the reference you loaded above for how to inspect a script's exact schema in your shape).
  • meta.outputDataValidation
    — what validating
    data
    did:
    • { skipped: false, droppedPaths: null }
      — validated, nothing removed.
    • { skipped: false, droppedPaths: [...], instruction }
      — validated, but those paths were stripped from
      data
      : fields the script returned from the API that the
      outputSchema
      doesn't declare. If you need them, re-run with output validation skipped.
    • { skipped: true }
      — validation was bypassed;
      data
      is the raw, unchecked script output.
Reading dropped fields /
skipOutputDataValidation
.
To receive the raw, unvalidated result, opt out of output validation (the exact syntax differs by shape — see the reference you loaded above). Input validation is never skipped.
Trimming the result /
filterOutputData
.
To shrink a large result down to the fields you need, pass a jq expression that post-processes
data
(again, exact syntax per shape). The jq runs against
data
only, NOT the
{ data, meta }
envelope, so write it rooted at
data
(run the script's
--help
— or your shape's equivalent — to see its output schema). The transformed value replaces
data
,
meta
is preserved, and the result is NOT re-validated against the output schema.
<!-- BEGIN:skill-references-table -->
每个脚本都会返回一个
{ data, meta }
结构:
  • data
    ——脚本的结果(其
    outputSchema
    声明的结构;请参阅你加载的参考文档,了解如何在你的环境中查看脚本的确切模式)。
  • meta.outputDataValidation
    ——对
    data
    的验证结果:
    • { skipped: false, droppedPaths: null }
      ——已验证,未移除任何内容。
    • { skipped: false, droppedPaths: [...], instruction }
      ——已验证,但这些路径已从
      data
      中移除:脚本从API返回的字段未在
      outputSchema
      中声明。如果需要这些字段,请在跳过输出验证的情况下重新运行。
    • { skipped: true }
      ——已绕过验证;
      data
      为原始的、未经过检查的脚本输出。
读取被移除的字段 /
skipOutputDataValidation
。若要接收原始的未验证结果,请选择退出输出验证(确切语法因环境而异——请参阅你加载的参考文档)。输入验证永远不会被跳过。
精简结果 /
filterOutputData
。若要将大型结果精简为你需要的字段,请传入一个jq表达式对
data
进行后处理(同样,确切语法因环境而异)。jq仅针对
data
运行,而非
{ data, meta }
结构,因此请以
data
为根编写表达式(运行脚本的
--help
——或你的环境中的等效命令——查看其输出模式)。转换后的值将替换
data
meta
会被保留,且结果不会再次根据输出模式进行验证。
<!-- BEGIN:skill-references-table -->

References

参考文档

Load the matching reference file before working in that area:
ReferenceCoversLoad it when
references/google-ads-api-gotchas.mdAuth headers, account hierarchy, GAQL, micros, mutate semantics, errors, rate limits, conversion tracking, versioning.Before composing a GAQL query, working with money fields (micros), setting campaign status, or interpreting a Google Ads API error.
<!-- END:skill-references-table -->
在对应领域工作前,请加载匹配的参考文档:
参考文档涵盖内容加载时机
references/google-ads-api-gotchas.md认证头、账户层级、GAQL、微单位、mutate语义、错误、速率限制、转化跟踪、版本控制。在编写GAQL查询、处理金额字段(微单位)、设置广告系列状态或解读Google Ads API错误前。
<!-- END:skill-references-table -->