AI Auto Negative Keywords
Reviews search terms and adds negative keywords automatically using AI-evaluated rules you configure in a companion admin panel, with email summaries of every change.
by Charles Bannister (shabba.io)·shabba.io/google_ads_scripts/ai-auto-negative-keywords
Overview
Pulls recent search terms and evaluates each against rules you define, using an LLM to decide whether a term is irrelevant, then adds negatives at the level you choose. Rules and API keys are managed in shabba's admin panel (autoneg.shabba.io) and read into the script via a linked Google Sheet. Use it to keep wasteful queries out of Search, Shopping and Performance Max without hand-reviewing every term.
Setup
- 1Copy the Google Sheet template linked on the source page and configure your rules at autoneg.shabba.io.
- 2In Google Ads, go to Tools → Bulk Actions → Scripts.
- 3Click + to create a new script and paste the code below.
- 4Set SPREADSHEET_URL to your copied sheet. Keep DEBUG_MODE, OBFUSCATE_SEARCH_TERMS and TEST_MODE as false for live runs.
- 5Authorize the script, run a preview, review the proposed negatives, then schedule daily.
Configuration Variables
| Variable | Default |
|---|---|
SPREADSHEET_URL | YOUR_SPREADSHEET_URL_HERE |
NEGATIVE_MATCH_TYPE | EXACT |
DEBUG_MODE | false |
OBFUSCATE_SEARCH_TERMS | false |
TEST_MODE |
Expected Output
Fetched N search terms; evaluated against your rules. Added "cheap free download" as EXACT negative to Campaign X. Skipped "buy widgets online" (matched keep rule). Email sent summarizing added negatives.
Notes
THIRD-PARTY DEPENDENCY: this script relies on shabba.io's own hosted service — rules are configured at autoneg.shabba.io and the script calls autoneg.shabba.io APIs plus an external LLM provider (Claude/ChatGPT/Gemini). It requires a copied Google Sheet template and an LLM API key. If shabba changes or retires that service, the script may stop working. It also self-reports version/error info to shabba by default.