Single search terms lie: one query rarely spends enough to prove anything. N-grams aggregate the words inside your search terms, so a money-burning pattern like “free” or “diy repair” becomes visible across hundreds of queries at once. This script mines your last 90 days of search terms into 1- and 2-word n-grams and writes every high-spend, zero-conversion candidate to a Google Sheet for review — it never adds negatives by itself.

How it works

The script reads the search-query performance report for enabled campaigns, tokenizes every query, and rolls cost, conversions and clicks up to each unigram and bigram. Anything that spent at least MIN_COST with zero conversions is sorted by cost and pushed to your spreadsheet. You review the sheet and add the real losers as negative keywords — human judgement stays in the loop.

Setup

  1. Make a copy of the Sheets template (button above) or create a blank Google Sheet, and copy its URL.
  2. In Google Ads, go to Tools > Bulk actions > Scripts and create a new script.
  3. Paste the code, set SPREADSHEET_URL, LOOKBACK_DAYS and MIN_COST, then authorize.
  4. Preview once to validate the output, then schedule it to run Weekly.

Parameters

ParameterDescriptionDefault
SPREADSHEET_URLGoogle Sheet the candidates are written to—
LOOKBACK_DAYSRolling window of search-term data90
MIN_COSTMinimum spend before an n-gram is flagged50
MAX_NGRAM1 = unigrams only, 2 = unigrams + bigrams2
All four parameters live at the top of the script.