google-ads

GitHub

通过Google Ads API查询广告活动、关键词及花费数据。支持使用curl和jq进行GAQL搜索流查询,获取点击、转化和成本指标,需配置OAuth令牌和开发者令牌等认证信息。

data/skills-md/acedatacloud/skills/google-ads/SKILL.md NeverSight/learn-skills.dev

Trigger Scenarios

用户提及Google Ads或广告活动 查询广告花费、点击量、展示量或转化率 需要分析广告活动表现数据

Install

npx skills add NeverSight/learn-skills.dev --skill google-ads -g -y
More Options

Non-standard path

npx skills add https://github.com/NeverSight/learn-skills.dev/tree/main/data/skills-md/acedatacloud/skills/google-ads -g -y

Use without installing

npx skills use NeverSight/learn-skills.dev@google-ads

指定 Agent (Claude Code)

npx skills add NeverSight/learn-skills.dev --skill google-ads -a claude-code -g -y

安装 repo 全部 skill

npx skills add NeverSight/learn-skills.dev --all -g -y

预览 repo 内 skill

npx skills add NeverSight/learn-skills.dev --list

SKILL.md

Frontmatter
{
    "name": "google-ads",
    "license": "Apache-2.0",
    "metadata": {
        "author": "acedatacloud",
        "version": "1.0"
    },
    "connections": [
        "google\/ads"
    ],
    "description": "Query Google Ads campaigns, ad groups, keywords and spend via the Google Ads API (GAQL searchStream). Use when the user mentions Google Ads, ad campaigns, ad spend \/ cost, impressions \/ clicks \/ conversions on ads, or campaign performance.",
    "when_to_use": "Trigger when the user wants Google Ads reporting — list accessible\ncustomers, campaign \/ ad-group \/ keyword performance, spend and\nconversions. Read via GAQL. Needs the OAuth token PLUS a platform\ndeveloper token and a login-customer-id; if those env vars are\nabsent the connector isn't fully provisioned yet — tell the user.\n",
    "allowed_tools": [
        "Bash"
    ]
}

Query the Google Ads API via curl + jq. Three credentials are needed:

  • $GOOGLE_ADS_TOKEN — the user's OAuth bearer (adwords scope) → Authorization: Bearer $GOOGLE_ADS_TOKEN
  • $GOOGLE_ADS_DEVELOPER_TOKEN — the platform's developer token (injected server-side) → header developer-token: $GOOGLE_ADS_DEVELOPER_TOKEN
  • login-customer-id — the manager (MCC) id under which calls are made; use the target customer id, or $GOOGLE_ADS_LOGIN_CUSTOMER_ID if set (digits only, no dashes).

API version: the base is https://googleads.googleapis.com/<vNN>. Google ships a new vNN every ~4 months and retires old ones — set VER to the current supported version (check developers.google.com/google-ads/api release notes); the example uses v18.

If $GOOGLE_ADS_DEVELOPER_TOKEN is empty, the connector isn't fully provisioned — say so rather than calling the API (it would 401/DEVELOPER_TOKEN_NOT_APPROVED).

VER="v18"; BASE="https://googleads.googleapis.com/$VER"
AUTH="Authorization: Bearer $GOOGLE_ADS_TOKEN"; DEV="developer-token: $GOOGLE_ADS_DEVELOPER_TOKEN"
# Customers the OAuth user can access (ids are returned as customers/<id>)
curl -sS -H "$AUTH" -H "$DEV" "$BASE/customers:listAccessibleCustomers" | jq '.resourceNames'

Report with GAQL (searchStream)

CID="1234567890"   # target customer id, digits only
curl -sS -H "$AUTH" -H "$DEV" -H "login-customer-id: ${GOOGLE_ADS_LOGIN_CUSTOMER_ID:-$CID}" \
  -H "Content-Type: application/json" -d '{
  "query":"SELECT campaign.name, metrics.cost_micros, metrics.clicks, metrics.conversions FROM campaign WHERE segments.date DURING LAST_30_DAYS ORDER BY metrics.cost_micros DESC"
}' "$BASE/customers/$CID/googleAds:searchStream" \
  | jq '.[].results[]? | {campaign: .campaign.name, cost_usd: (.metrics.costMicros|tonumber/1e6), clicks: .metrics.clicks, conv: .metrics.conversions}'

GAQL resources: campaign, ad_group, ad_group_criterion (keywords), customer. Cost is metrics.cost_micros (÷ 1,000,000 = account currency).

Gotchas

  • Three headers, not one. Missing developer-token or login-customer-id is the #1 cause of 401/403 here.
  • Customer ids are digits only in URLs/headers (strip the dashes from 123-456-7890).
  • searchStream returns an array of chunks each with .results[] — flatten with .[].results[]?.
  • Cost is in micros of the account currency; divide by 1e6.

Version History

  • e0220ca Current 2026-07-05 22:53

Same Skill Collection

data/skills-md/00prabalk00/claude-skills/knowledge-base-gap-finder/SKILL.md
data/skills-md/01000001-01001110/agent-jira-skills/jira-agile/SKILL.md
data/skills-md/01000001-01001110/agent-jira-skills/jira-auth/SKILL.md
data/skills-md/01000001-01001110/agent-jira-skills/jira-issues/SKILL.md
data/skills-md/01000001-01001110/agent-jira-skills/jira-project-management/SKILL.md
data/skills-md/01000001-01001110/agent-jira-skills/jira-projects/SKILL.md
data/skills-md/01000001-01001110/agent-jira-skills/jira-safe/SKILL.md
data/skills-md/01000001-01001110/agent-jira-skills/jira-search/SKILL.md
data/skills-md/01000001-01001110/agent-jira-skills/jira-spaces/SKILL.md
data/skills-md/01000001-01001110/agent-jira-skills/jira-transitions/SKILL.md
data/skills-md/0731coderlee-sudo/wechat-publisher/wechat-publisher/SKILL.md
data/skills-md/0froq/skills/conventionalcommits/SKILL.md
data/skills-md/0froq/skills/nuxt/SKILL.md
data/skills-md/0froq/skills/oq/SKILL.md
data/skills-md/0froq/skills/pinia/SKILL.md
data/skills-md/0froq/skills/pnpm/SKILL.md
data/skills-md/0froq/skills/slidev/SKILL.md
data/skills-md/0froq/skills/tsdown/SKILL.md
data/skills-md/0froq/skills/turborepo/SKILL.md
data/skills-md/0froq/skills/unocss/SKILL.md
data/skills-md/0froq/skills/vitepress/SKILL.md
data/skills-md/0froq/skills/vitest/SKILL.md
data/skills-md/0froq/skills/vue-best-practices/SKILL.md
data/skills-md/0froq/skills/vue-router-best-practices/SKILL.md
data/skills-md/0froq/skills/vue-testing-best-practices/SKILL.md
data/skills-md/0froq/skills/vue/SKILL.md
data/skills-md/0froq/skills/vueuse-functions/SKILL.md
data/skills-md/0froq/skills/web-design-guidelines/SKILL.md
data/skills-md/0juano/agent-skills/bondterminal-x402/SKILL.md
data/skills-md/0juano/agent-skills/edgeone-pages-deploy/SKILL.md
data/skills-md/0juano/agent-skills/ley-ar/SKILL.md
data/skills-md/0juano/agent-skills/ticktick/SKILL.md
data/skills-md/0juano/agent-skills/x-image-cards/SKILL.md
data/skills-md/0juano/x-image-cards/x-image-cards/SKILL.md
data/skills-md/0x0funky/agent-sprite-forge/generate2dsprite/SKILL.md
data/skills-md/0x0funky/agent-sprite-forge/video2dsprite/SKILL.md
data/skills-md/0x2e/superpowers/brainstorming/SKILL.md
data/skills-md/0x2e/superpowers/dispatching-parallel-agents/SKILL.md
data/skills-md/0x2e/superpowers/executing-plans/SKILL.md
data/skills-md/0x2e/superpowers/finishing-a-development-branch/SKILL.md
data/skills-md/0x2e/superpowers/receiving-code-review/SKILL.md
data/skills-md/0x2e/superpowers/requesting-code-review/SKILL.md
data/skills-md/0x2e/superpowers/subagent-driven-development/SKILL.md
data/skills-md/0x2e/superpowers/systematic-debugging/SKILL.md
data/skills-md/0x2e/superpowers/test-driven-development/SKILL.md
data/skills-md/0x2e/superpowers/using-git-worktrees/SKILL.md
data/skills-md/0x2e/superpowers/using-superpowers/SKILL.md
data/skills-md/0x2e/superpowers/verification-before-completion/SKILL.md
data/skills-md/0x2e/superpowers/writing-plans/SKILL.md
data/skills-md/0x2e/superpowers/writing-skills/SKILL.md

Metadata

Files
0
Version
5f4efd0
Hash
0630ca8b
Indexed
2026-07-05 22:53

Home - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-14 10:55
浙ICP备14020137号-1 $Map of visitor$