How to write Google Ads scripts with AI
Using Claude to write Google Ads scripts that actually run, and how to avoid the usual problems with AI-generated code.
AI assistants can write a working Google Ads script from a description. The difficulty is everything around the code: outdated API calls, invented field names, and the copy-paste loop between a chat window and Google Ads.
Where AI-written scripts usually fail
- Old syntax. Much of what is published online predates the current scripts experience and its query language.
- Fields that do not exist. A plausible-looking metric name is still wrong.
- No knowledge of your account. The assistant guesses campaign names, labels and conversion actions.
- No feedback. It never sees the error message, so you carry it back and forth.
Giving the assistant what it needs
With the Claude connector, Claude works inside your chiliad workspace:
- It follows chiliad's authoring rules, so scripts have the right structure.
- It can run read-only GAQL queries against your account to see real campaign names, labels and numbers before writing a line.
- It saves the script to your workspace, assigns it to accounts and sets their values.
- It can read the results of each run, including error messages, and fix the code.
Writing a good request
- State the outcome and the action. "Email me whenβ¦", "pauseβ¦", "write to this sheetβ¦".
- Give the thresholds and the period. "More than 100 clicks and no conversions in the last 30 days."
- Name the accounts.
- Say what must not happen. "Do not touch brand campaigns."
Review before you rely on it
Read the summary of what the script does, run a preview in Google Ads, and compare the first results with the account. The script is saved with full version history marked as written by Claude, so you can see and undo every change.
- 1
Describe the outcome in plain language: the account, the rule, who should be told.
- 2
Each action Claude takes in chiliad appears as a tool call that you can inspect.
- 3
Claude hands back the loader and the next steps. Everything it created is in your dashboard, with versions marked Claude (MCP).