Logo di Google Ads Open Cli

Google Ads Open Cli

Community
Bin-Huang
google-ads-open-cli

Google Ads data analysis and reporting via google-ads-open-cli. Use when the user wants to check Google Ads performance, pull campaign/ad group/keyword stats, explore account structure, audit conversions, or run custom GAQL queries. Triggers: "Google Ads", "ad performance", "campaign stats", "GAQL", "ad spend", "keyword report", "search terms", "conversion tracking", "impression share", "ad account".

Panoramica

AutoreBin-Huang
Repositorygoogle-ads-open-cli
Nome della skillgoogle-ads-open-cli
Stelle
48
Fork
5
File inclusi
Solo istruzioni
LicenzaApache-2.0
Link
  • Istruzioni in Markdown

    Un file SKILL.md che il modello carica quando serve, consumando token solo quando una richiesta è effettivamente pertinente.

  • Funziona con qualsiasi LLM

    Le skill IA sono in semplice Markdown, non in codice specifico di un fornitore, quindi funzionano con GPT, Claude, Gemini, Grok o un modello locale.

  • Tutto nelle istruzioni

    Tutto ciò che serve al modello è nelle istruzioni: nessun file aggiuntivo da sincronizzare.

  • Open source

    Pubblicata da Bin-Huang su GitHub. Leggi i sorgenti prima di installarla.

Installazione

Installa la skill IA Google Ads Open Cli in TypingMind per usarla con qualsiasi LLM, oppure copiala in un altro agente in grado di leggere SKILL.md.

1

Installa in TypingMind

TypingMind installa una skill direttamente dalla sua cartella GitHub: legge SKILL.md, raccoglie i file delle risorse e salva il risultato in locale.

  1. Apri l'app e vai su Plugin → Skill.
  2. Scegli "Installa da GitHub".
  3. Incolla l'URL della cartella della skill riportato qui sotto e conferma.
    https://github.com/Bin-Huang/google-ads-open-cli/tree/main/skills/google-ads-open-cli
  4. Attiva la skill in ogni chat in cui vuoi averla a disposizione.
Plugin → Skill → Nuova skill → Da URL GitHub, poi incolla l'URL della cartella e premi Continua.
2

Installa in un altro agente

Qualsiasi agente che legge il formato Agent Skills può usare questa skill: copia la cartella nella cartella delle skill di quell'agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Bin-Huang/google-ads-open-cli.git /tmp/google-ads-open-cli
mkdir -p .claude/skills
cp -r /tmp/google-ads-open-cli/skills/google-ads-open-cli .claude/skills/google-ads-open-cli
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva Google Ads Open Cli in qualsiasi chat di TypingMind e al resto pensa il modello. Il nome e la descrizione della skill sono nel prompt di sistema e, non appena arriva una richiesta pertinente, il modello carica da solo le istruzioni complete: non devi mai richiamarla manualmente e non consuma token finché non viene effettivamente usata.

Il modello carica automaticamente Google Ads Open Cli non appena riceve una richiesta pertinente.

Funziona con qualsiasi modello IA

Le skill IA sono semplici istruzioni in Markdown, non codice specifico di un fornitore, quindi Google Ads Open Cli non è vincolata al modello per cui è stata scritta. Installala una sola volta in TypingMind e usala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modello locale che esegui tu, sempre con le tue chiavi API.

  • Caricata solo quando serve

    Il prompt di sistema contiene solo il nome e la descrizione. Le istruzioni vengono recuperate alla prima richiesta pertinente, quindi una skill inutilizzata non costa nulla.

  • Cambia modello durante la chat

    Poiché la skill è composta da istruzioni e non da codice, continua a funzionare anche se cambi modello: il nuovo modello legge lo stesso file SKILL.md.

Istruzioni della skill

Questo è il contenuto di SKILL.md che il modello carica. Leggilo prima dell'installazione: una skill è un insieme di istruzioni che il tuo modello seguirà.

Google Ads CLI Skill

You have access to google-ads-open-cli, a read-only CLI for the Google Ads API (v23). Use it to query ad accounts, pull performance stats, and run custom GAQL queries.

Quick start

bash
# Check if the CLI is available
google-ads-open-cli --help

# List accessible accounts
google-ads-open-cli customers

# Check that credentials can read a real account
google-ads-open-cli customer 1234567890

If the CLI is not installed, install it:

bash
npm install -g google-ads-open-cli

Authentication

The CLI uses OAuth2 user credentials. The Google Ads API also supports service accounts, but this CLI does not support them yet. Credentials are stored in ~/.config/google-ads-open-cli/credentials.json.

Before you run other commands, check the credentials with a real customer ID: google-ads-open-cli customer <customer-id>, or a GAQL query such as google-ads-open-cli query <customer-id> "SELECT customer.id FROM customer". Do NOT use customers for this check. customers succeeds even when the Cloud project has only Test access, which cannot read production accounts. If you do not know a customer ID, run customers to find one, then run customer <id>.

If the check fails, use the error table below. If the user must sign in, ask the user to run this command in their own terminal:

bash
google-ads-open-cli auth login --client-id=xxx --client-secret=xxx

Do NOT run auth login yourself. It opens a browser and blocks for up to 120 seconds while it waits for the user to approve. With --no-browser, it prints the authorization URL instead of opening a browser. Other options: --login-customer-id <id> for access through a manager (MCC) account, and --port <port> with ssh -L on a remote machine (see Remote machines in the README).

A developer token is NOT required. Google stopped checking developer tokens on September 9, 2026. The access level now belongs to the Google Cloud project that owns the OAuth client.

How the user gets the values:

  1. Enable the Google Ads API in a Google Cloud project.
  2. In Google Auth Platform, configure the OAuth consent screen: add the scope https://www.googleapis.com/auth/adwords, and add the user's Google account as a test user while the app is in Testing status.
  3. Under Clients, create an OAuth client of type Desktop app. Copy the client ID and the client secret.
  4. A new Cloud project has Test access, which works only with test accounts. To read real accounts, apply for Explorer access on the Google Ads API Overview page of that project.

For CI/CD, set GOOGLE_ADS_REFRESH_TOKEN, GOOGLE_ADS_CLIENT_ID and GOOGLE_ADS_CLIENT_SECRET. The CLI refreshes the access token itself. GOOGLE_ADS_ACCESS_TOKEN alone also works, but it expires after about 1 hour.

Setup errors

Error containsCauseWhat to tell the user
No credentials found or Credentials file not foundThe CLI has no credentials.Run google-ads-open-cli auth login --client-id=xxx --client-secret=xxx in their own terminal.
ACTION_NOT_PERMITTED, CLOUD_PROJECT_NOT_APPROVED_FOR_PRODUCTION, or only approved for use with test accountsThe Cloud project has Test access, so it can read only test accounts.Apply for Explorer access on the Google Ads API Overview page of the Cloud project. Google has known issues: some applications are rejected when the project is on the free trial or its billing account is suspended or disabled, and some projects upgraded after September 9, 2026 still get AUTHORIZATION_ERROR (workaround: apply with a new Cloud project).
Token refresh failed and The refresh token is expired or revokedThe refresh token expired or was revoked. In Testing status, refresh tokens expire after 7 days.Run auth login again in their own terminal. In CI, also update GOOGLE_ADS_REFRESH_TOKEN. To remove the 7-day limit, publish the OAuth app (In production) in Google Auth Platform.
Token refresh failed and Check the OAuth client ID and client secretThe OAuth client ID or client secret is wrong, or the OAuth client was deleted.Check the client ID and the client secret in Google Auth Platform, then run auth login again.
Google Ads API has not been used in projectThe Google Ads API is not enabled in the Cloud project.Enable the Google Ads API at the link in the error, wait a few minutes, then retry.
USER_PERMISSION_DENIEDThe signed-in Google account cannot access this customer, or a manager account is needed.Check the customer ID. For access through a manager account, run auth login --login-customer-id <manager-id>. With env var credentials, set GOOGLE_ADS_LOGIN_CUSTOMER_ID instead.
Incomplete environment credentialsOnly some of the refresh token env vars are set.Set all of GOOGLE_ADS_REFRESH_TOKEN, GOOGLE_ADS_CLIENT_ID and GOOGLE_ADS_CLIENT_SECRET.

Entity hierarchy

Manager Account (MCC)
 └── Customer Account (10-digit ID, e.g. 1234567890)
      ├── Campaign
      │    └── Ad Group
      │         ├── Ad (Ad Group Ad)
      │         └── Keyword (Ad Group Criterion)
      ├── Campaign Budget
      ├── Conversion Action
      ├── User List (remarketing)
      └── Asset (images, videos, sitelinks)

Customer IDs are 10-digit numbers. Dashes are stripped automatically.

Monetary values

Google Ads uses micros: 1 currency unit = 1,000,000 micros. All cost/bid/budget values returned by the CLI are in micros. Always divide by 1,000,000 when presenting monetary values to the user.

Output format

All commands output pretty-printed JSON by default. Use --format compact for single-line JSON (useful for piping).

Built-in commands

Account discovery

bash
# List all accessible accounts
google-ads-open-cli customers

# Get details for a specific account
google-ads-open-cli customer 1234567890

# List sub-accounts under an MCC
google-ads-open-cli account-hierarchy 1234567890

Browsing entities

bash
# Campaigns (filter by status: ENABLED, PAUSED, REMOVED)
google-ads-open-cli campaigns 1234567890
google-ads-open-cli campaigns 1234567890 --status ENABLED

# Get a specific campaign
google-ads-open-cli campaign 1234567890 98765

# Campaign budgets
google-ads-open-cli campaign-budgets 1234567890

# Ad groups (filter by campaign, status)
google-ads-open-cli ad-groups 1234567890 --campaign 98765

# Get a specific ad group
google-ads-open-cli ad-group 1234567890 11111

# Ads (filter by campaign, ad group, status)
google-ads-open-cli ads 1234567890 --campaign 98765 --ad-group 11111

# Get a specific ad (requires ad-group-id and ad-id)
google-ads-open-cli ad 1234567890 11111 22222

# Keywords
google-ads-open-cli keywords 1234567890 --campaign 98765 --status ENABLED

All listing commands support --limit <n> (default 100).

Performance stats

Stats commands require --start and --end dates (YYYY-MM-DD). They return at most --limit rows (default 1000), newest date first (keyword-stats: highest impressions first). If stderr has a {"warning": ...} about truncation, increase --limit or narrow the date range before you compute totals:

bash
# Campaign stats
google-ads-open-cli campaign-stats 1234567890 --start 2026-01-01 --end 2026-01-31

# Campaign stats with device segment
google-ads-open-cli campaign-stats 1234567890 --start 2026-01-01 --end 2026-01-31 --segments device

# Ad group stats (filter by --campaign and/or --ad-group)
google-ads-open-cli ad-group-stats 1234567890 --start 2026-01-01 --end 2026-01-31 --campaign 98765

# Ad-level stats (filter by --campaign and/or --ad-group)
google-ads-open-cli ad-stats 1234567890 --start 2026-01-01 --end 2026-01-31

# Keyword stats (sorted by impressions desc; filter by --campaign and/or --ad-group)
google-ads-open-cli keyword-stats 1234567890 --start 2026-01-01 --end 2026-01-31

Available segments for campaign-stats --segments: device, ad_network_type, day_of_week (comma-separated).

Stats commands default to --limit 1000.

Other commands

bash
# Audiences and remarketing lists
google-ads-open-cli audiences 1234567890
google-ads-open-cli user-lists 1234567890

# Assets and extensions
google-ads-open-cli assets 1234567890 --type SITELINK
google-ads-open-cli extensions 1234567890 --campaign 98765

# Conversions and billing
google-ads-open-cli conversion-actions 1234567890
google-ads-open-cli billing 1234567890

# Change history (default last 14 days, --days max 90)
google-ads-open-cli change-status 1234567890 --days 30 --limit 20

# Negative keyword lists
google-ads-open-cli negative-keywords 1234567890

Asset types: IMAGE, MEDIA_BUNDLE, TEXT, YOUTUBE_VIDEO, LEAD_FORM, CALL, CALLOUT, SITELINK, STRUCTURED_SNIPPET.

Custom GAQL queries

The query command is the escape hatch for anything not covered by built-in commands. It runs arbitrary GAQL (Google Ads Query Language) against the Google Ads API.

bash
google-ads-open-cli query <customer-id> "<GAQL>"

GAQL syntax

sql
SELECT field1, field2, ...
FROM resource_name
WHERE conditions
ORDER BY field [ASC|DESC]
LIMIT count
PARAMETERS key=value
  • SELECT and FROM are required. WHERE, ORDER BY, LIMIT, PARAMETERS are optional.
  • Keywords (SELECT, FROM, WHERE, etc.) are case-insensitive.
  • Field names, resource names, and enum values are case-sensitive.
  • No OR operator -- all WHERE conditions are AND-ed together.
  • No JOIN, GROUP BY, HAVING, or subqueries.

WHERE operators

OperatorExample
=, !=, >, <, >=, <=campaign.status = 'ENABLED'
IN, NOT INcampaign.status IN ('ENABLED', 'PAUSED')
LIKE, NOT LIKEcampaign.name LIKE '%brand%' (case-insensitive)
REGEXP_MATCHcampaign.name REGEXP_MATCH '(?i)brand'
BETWEEN ... AND ...segments.date BETWEEN '2026-01-01' AND '2026-01-31'
DURINGsegments.date DURING LAST_30_DAYS
IS NULL, IS NOT NULLad_group_ad.ad.final_urls IS NOT NULL
CONTAINS ANY/ALL/NONEFor repeated fields

Date filtering

Custom range:

sql
WHERE segments.date BETWEEN '2026-01-01' AND '2026-01-31'

Predefined ranges (with DURING):

  • TODAY, YESTERDAY
  • LAST_7_DAYS, LAST_14_DAYS, LAST_30_DAYS (NOT including today)
  • THIS_MONTH, LAST_MONTH
  • THIS_WEEK_SUN_TODAY, THIS_WEEK_MON_TODAY
  • LAST_WEEK_SUN_SAT, LAST_WEEK_MON_SUN
  • LAST_BUSINESS_WEEK

Common resource names (FROM clause)

Entities: customer, campaign, campaign_budget, ad_group, ad_group_ad, ad_group_criterion, campaign_criterion

View resources (for metrics): keyword_view, search_term_view, geographic_view, gender_view, age_range_view, landing_page_view, ad_group_audience_view, shopping_performance_view, click_view

Other: change_status, change_event, conversion_action, asset, bidding_strategy, label, recommendation, shared_set, shared_criterion

Common metrics

Performance: metrics.impressions, metrics.clicks, metrics.cost_micros, metrics.ctr, metrics.average_cpc, metrics.average_cpm, metrics.interactions

Conversions: metrics.conversions, metrics.conversions_value, metrics.all_conversions, metrics.cost_per_conversion, metrics.conversion_rate, metrics.value_per_conversion

Impression share: metrics.search_impression_share, metrics.search_budget_lost_impression_share, metrics.search_rank_lost_impression_share, metrics.absolute_top_impression_percentage, metrics.top_impression_percentage

Video: metrics.video_views, metrics.video_view_rate, metrics.average_cpv

Common segments

Date: segments.date, segments.week, segments.month, segments.quarter, segments.year, segments.hour_of_day, segments.day_of_week

Device/network: segments.device, segments.ad_network_type, segments.slot, segments.click_type

Conversion: segments.conversion_action, segments.conversion_action_name, segments.conversion_action_category

Important GAQL rules

  1. Date range required with date segments. If segments.date (or segments.week, segments.month, etc.) is in SELECT, a finite date range filter MUST be in WHERE.

  2. Non-date segments in WHERE must be in SELECT. Exception: date segments can appear in WHERE without being in SELECT.

  3. Removed entities are included by default. The API does NOT filter out removed entities. Add campaign.status != 'REMOVED' (or equivalent) to match Google Ads UI behavior.

  4. Field compatibility. Not all fields can be selected together. If you get an error about incompatible fields, remove fields one at a time or consult the Google Ads API field compatibility documentation.

  5. ORDER BY fields must be in SELECT. You can only order by fields that appear in the SELECT clause.

  6. Attributed resources. You can select parent entity fields without them being in FROM. For example, campaign.name is available when FROM ad_group.

GAQL query examples

Search terms that triggered ads:

bash
google-ads-open-cli query 1234567890 "SELECT search_term_view.search_term, search_term_view.status, campaign.name, ad_group.name, metrics.clicks, metrics.impressions, metrics.ctr, metrics.cost_micros FROM search_term_view WHERE segments.date DURING LAST_30_DAYS ORDER BY metrics.impressions DESC LIMIT 50"

Campaign performance by device:

bash
google-ads-open-cli query 1234567890 "SELECT campaign.name, segments.device, metrics.impressions, metrics.clicks, metrics.ctr, metrics.cost_micros, metrics.conversions FROM campaign WHERE segments.date DURING LAST_30_DAYS AND campaign.status != 'REMOVED'"

Impression share analysis:

bash
google-ads-open-cli query 1234567890 "SELECT campaign.name, metrics.search_impression_share, metrics.search_budget_lost_impression_share, metrics.search_rank_lost_impression_share, metrics.clicks, metrics.impressions, metrics.cost_micros FROM campaign WHERE segments.date DURING LAST_7_DAYS AND campaign.status = 'ENABLED' ORDER BY metrics.search_budget_lost_impression_share DESC"

Landing page performance:

bash
google-ads-open-cli query 1234567890 "SELECT landing_page_view.unexpanded_final_url, metrics.clicks, metrics.impressions, metrics.ctr, metrics.cost_micros, metrics.conversions FROM landing_page_view WHERE segments.date DURING LAST_30_DAYS ORDER BY metrics.clicks DESC LIMIT 20"

Demographics -- age breakdown:

bash
google-ads-open-cli query 1234567890 "SELECT ad_group_criterion.age_range.type, campaign.name, metrics.clicks, metrics.impressions, metrics.ctr, metrics.cost_micros FROM age_range_view WHERE segments.date DURING LAST_30_DAYS"

Geographic performance (by user location):

bash
google-ads-open-cli query 1234567890 "SELECT geographic_view.country_criterion_id, geographic_view.location_type, campaign.name, metrics.clicks, metrics.impressions, metrics.cost_micros FROM geographic_view WHERE segments.date DURING LAST_30_DAYS ORDER BY metrics.clicks DESC LIMIT 50"

Ad copy performance (responsive search ads):

bash
google-ads-open-cli query 1234567890 "SELECT ad_group_ad.ad.responsive_search_ad.headlines, ad_group_ad.ad.responsive_search_ad.descriptions, ad_group_ad.ad.final_urls, ad_group_ad.status, metrics.clicks, metrics.impressions, metrics.ctr, metrics.cost_micros FROM ad_group_ad WHERE segments.date DURING LAST_30_DAYS AND ad_group_ad.status != 'REMOVED' AND ad_group_ad.ad.type = 'RESPONSIVE_SEARCH_AD' ORDER BY metrics.clicks DESC LIMIT 20"

Conversion actions audit:

bash
google-ads-open-cli query 1234567890 "SELECT conversion_action.name, conversion_action.type, conversion_action.status, conversion_action.category, conversion_action.counting_type, conversion_action.click_through_lookback_window_days, conversion_action.view_through_lookback_window_days FROM conversion_action WHERE conversion_action.status = 'ENABLED'"

Shopping product performance:

bash
google-ads-open-cli query 1234567890 "SELECT segments.product_item_id, segments.product_title, metrics.clicks, metrics.impressions, metrics.ctr, metrics.cost_micros, metrics.conversions, metrics.conversions_value FROM shopping_performance_view WHERE segments.date DURING LAST_30_DAYS ORDER BY metrics.conversions_value DESC LIMIT 50"

Account-level daily trend:

bash
google-ads-open-cli query 1234567890 "SELECT segments.date, metrics.clicks, metrics.impressions, metrics.ctr, metrics.cost_micros, metrics.conversions, metrics.conversions_value FROM customer WHERE segments.date DURING LAST_30_DAYS ORDER BY segments.date"

Workflow guidance

When the user asks for a quick overview

  1. Run google-ads-open-cli customers to find accessible accounts, then customer <id> to confirm access
  2. Use campaign-stats with a recent date range for a performance snapshot
  3. Present the data with costs converted from micros to currency

When the user asks for deep analysis

  1. Start with campaign-stats to identify the scope
  2. Drill down with ad-group-stats or keyword-stats for underperforming campaigns
  3. Use custom GAQL queries for specific analysis (search terms, demographics, impression share, landing pages)
  4. Cross-reference with conversion-actions to verify tracking setup

When the user asks about specific metrics not in built-in commands

Use the query command with GAQL. Common scenarios:

  • Search terms report -- use search_term_view
  • Geographic data -- use geographic_view
  • Demographics -- use gender_view, age_range_view
  • Landing pages -- use landing_page_view
  • Impression share -- select metrics.search_impression_share and related fields from campaign
  • Shopping products -- use shopping_performance_view
  • Change history -- use change_event for detailed logs

Error handling

  • Authentication and access errors -- see the setup error table in the Authentication section
  • "field is not compatible" -- some fields cannot be selected together; remove incompatible fields and retry
  • Empty results -- check date range, status filters, and whether the account has data for the requested entities
  • "MISALIGNED_DATE_FOR_FILTER" -- when filtering segments.month or segments.quarter, the date must be the first day of the period

API documentation references

Domande frequenti

Cosa fa la skill IA Google Ads Open Cli?

Google Ads data analysis and reporting via google-ads-open-cli. Use when the user wants to check Google Ads performance, pull campaign/ad group/keyword stats, explore account structure, audit conversions, or run custom GAQL queries. Triggers: "Google Ads", "ad performance", "campaign stats", "GAQL", "ad spend", "keyword report", "search terms", "conversion tracking", "impression share", "ad account".

Perché usare Google Ads Open Cli su TypingMind?

Perché la installi una volta e la usi con qualsiasi modello. Google Ads Open Cli è scritta in semplice Markdown anziché in codice specifico di un fornitore, quindi la stessa skill funziona con GPT-5, Claude, Gemini, Grok o un modello locale, e puoi cambiare modello durante la chat senza che smetta di funzionare. TypingMind usa le tue chiavi API, quindi paghi direttamente i fornitori anziché un abbonamento per posto utente, e le tue skill e chat restano nel tuo spazio di archiviazione.

Come installo Google Ads Open Cli in TypingMind?

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/Bin-Huang/google-ads-open-cli/tree/main/skills/google-ads-open-cli. TypingMind legge il file SKILL.md e installa la skill, che puoi abilitare per ogni singola chat.

Quali modelli IA possono usare Google Ads Open Cli?

Qualsiasi modello che colleghi in TypingMind. Le skill IA sono semplici istruzioni in Markdown anziché codice specifico di un fornitore, quindi GPT, Claude, Gemini, Grok e i modelli locali possono tutti caricare questa skill quando una richiesta corrisponde al suo scopo.

Quanti modelli IA posso usare con Google Ads Open Cli?

Quanti ne vuoi. Se un modello supporta le skill, puoi usarlo con Google Ads Open Cli: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e molti altri, tutti su TypingMind con le tue chiavi API.

La skill IA Google Ads Open Cli è gratuita?

Sì. È pubblicata su GitHub da Bin-Huang con licenza Apache-2.0. Paghi solo il tuo fornitore IA per i token che usi.

Cosa sono le skill IA?

Una skill IA è un pacchetto di istruzioni riutilizzabili che insegna a un modello IA come svolgere un'attività specifica. Segue il formato aperto Agent Skills: un file SKILL.md con un nome e una descrizione, più eventuali script, modelli o file di riferimento di cui il modello potrebbe aver bisogno. Il modello legge le istruzioni solo quando la tua richiesta corrisponde alla skill, quindi una skill installata non comporta costi finché non viene usata.

In cosa si differenziano le skill IA dai plugin o dai server MCP?

Un plugin o un server MCP fornisce a un modello nuovi strumenti da richiamare: codice che viene eseguito da qualche parte e restituisce un risultato. Una skill IA, invece, fornisce al modello conoscenze e procedure: come affrontare un'attività, quali passaggi seguire e quali caratteristiche deve avere un buon output. Le skill sono semplici istruzioni in Markdown, quindi non richiedono server, chiavi API né ambienti di esecuzione e funzionano con qualsiasi modello.

Vedi tutti

Crea subito la tua area di lavoro IA

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇