The Google Ads API Developer Assistant is a powerful extension for the Gemini CLI designed to accelerate your Google Ads API workflows. The Assistant lets you interact with the Google Ads API using natural language, making it easier to ask questions, generate code, retrieve data, and troubleshoot issues directly within your terminal.
Benefits
- Boost productivity: Spend less time searching documentation and writing boilerplate code.
- Simplify complex tasks: Generate Google Ads Query Language (GAQL) and client library code from simple English prompts.
- Learn the API: Understand API concepts and see how natural language requests translate to executable code.
- Interactive debugging: Get help understanding errors and step-by-step guidance on troubleshooting.
- Streamlined workflow: Keep your development and testing loop within the command line.
Prerequisites
Before you begin, make sure you have the following:
Google Ads API Access:
- A Google Ads API developer token.
- A
google-ads.yamlfile configured with your developer token, OAuth 2.0 credentials, and customer ID, typically located in your home directory. See the client library configuration guide. - Familiarity with Google Ads API concepts and authentication.
Software:
- Python 3.10 or newer. Python is the default language, so you must have this installed and on your path.
- The Gemini CLI installed.
- jq (command-line JSON processor). The setup script will attempt to install this if missing.
Repository:
- A local clone of the
google-ads-api-developer-assistantrepository from GitHub:none git clone https://github.com/googleads/google-ads-api-developer-assistant.git
- A local clone of the
Get started
Navigate to the project directory:
none cd <full path>/google-ads-api-developer-assistantRun the setup script: This script configures the Gemini CLI to use the assistant's
GEMINI.mdcontext files and necessary tools.none ./setup.shIf you are on Windows, run thesetup.ps1PowerShell script.Start the Gemini CLI:
none geminiInteract with the Assistant: You can now ask questions or give commands in natural language.
Key features
Natural language Q&A: Ask questions about Google Ads API features, best practices, or specific resources.
- "What are the available campaign types?"
- "How do I filter by date in GAQL?"
- "Explain the difference between click_view and impression_view."
Code generation: Generate GAQL queries and executable Python code snippets.
- "Show me campaigns with the most conversions in the last 30 days."
- "Get all enabled ad group names for campaign ID 12345."
- "Find disapproved ads across all campaigns."
Generated code is saved in the
saved_code/directory.
Direct API execution: Run generated read-only Python scripts directly from the Gemini CLI and view formatted results in your terminal. After the Assistant has generated the code, you will receive an on-screen prompt:
To run this script, you will need to replace YOUR_CUSTOMER_ID with your actual Google Ads
customer ID and execute the following command in your shell: <command>
Enter run, and the script will execute in the Assistant context.
CSV export: Save tabular results from API calls to a CSV file.
- "Save the results to a CSV file."
Files are saved in the
saved_csv/directory.
- "Save the results to a CSV file."
Files are saved in the
Troubleshooting assistance: Get help with error messages or unexpected API behavior.
- "I got the error 'AuthenticationError.OAUTH_TOKEN_INVALID', what should I do?"
- "Why am I not seeing any results for my query?"
Example use cases
- Reporting:
- "Get me the top 5 keywords by cost for last month for customer 12345678."
- Account structure:
- "List all campaign names and their IDs."
- Troubleshooting:
- "I uploaded 100 conversions, but only 78 appear in the UI. How can I debug this using the API?"
- Learning:
- "Walk me through how to create a Performance Max campaign using the API."
Community and support
- GitHub issues: Report bugs, suggest features, or ask for help on the Issues tab in the repository.
- Discord: Join the discussion in the
#ads-api-ai-toolschannel on the Google Advertising and Measurement Community Discord server. - Feedback: Share your feedback through this survey form.
Contribution guidelines
Contributions are welcome! See the CONTRIBUTING.md file in the GitHub
repository for guidelines.