Search Term N-Gram Analyzer
Breaks all search terms into 1-, 2- and 3-word patterns and aggregates performance per pattern — surfacing the systemic waste your negative keywords miss and the converting themes worth breaking out.
by Brainlabs & Nils Rooijmans (concept), chiliad (rewrite)·chiliad.io
Overview
Individual search terms are too noisy to act on; the words inside them are not. The N-Gram Analyzer splits every search term from the chosen date range into 1-, 2- and 3-word combinations and aggregates cost, clicks and conversions per combination. The output is two lists per n-gram size: WASTE (patterns that spent real money with zero conversions — negative keyword candidates) and WINNERS (the highest-converting patterns — themes worth their own ad groups or bids).
Setup
- 1Open your Google Ads account and go to Tools → Bulk Actions → Scripts.
- 2Click the + button to create a new script and paste the code below.
- 3Set DATE_RANGE (LAST_30_DAYS by default; use LAST_90_DAYS for lower-volume accounts).
- 4Adjust MIN_WASTE_COST to your account's scale — it filters the waste list to patterns that actually hurt.
- 5Set EMAIL_ADDRESS to receive the waste list; leave blank for logs only.
- 6Preview once to verify, then schedule monthly.
Configuration Variables
| Variable | Default |
|---|---|
DATE_RANGE | LAST_30_DAYS |
MIN_WASTE_COST | 50 |
TOP_N | 20 |
MAX_SEARCH_TERMS | 50000 |
EMAIL_ADDRESS |
Expected Output
Analyzed 18342 search terms (LAST_30_DAYS). === 1-WORD N-GRAMS - TOP WASTE (0 conversions, cost >= 50) === "free" cost: 412.80 clicks: 391 conversions: 0.0 search terms: 214 "jobs" cost: 187.22 clicks: 96 conversions: 0.0 search terms: 41 === 1-WORD N-GRAMS - TOP WINNERS (by conversions) === "buy" cost: 1204.10 clicks: 890 conversions: 64.0 search terms: 156 === 2-WORD N-GRAMS - TOP WASTE (0 conversions, cost >= 50) === "near me" cost: 240.15 clicks: 168 conversions: 0.0 search terms: 77 Email sent to you@example.com
Notes
Each n-gram row aggregates every search term containing that pattern, so review before excluding — 'free' in 'sugar free' is not the same as in 'free download'. Conversions are attributed to every n-gram in the converting term, so columns don't sum to account totals. A classic PPC analysis technique, implemented fresh for GAQL.