Search Term Harvester
Scans the search terms report for high-converting queries and adds them as exact match keywords in the matching ad group. Runs in dry-run mode by default so you can review before applying.
by Dmytro Tonkikh·chiliad.io
Overview
Search Term Harvester scans the last 30 days of search query data across all enabled campaigns and surfaces queries that have driven at least the minimum number of conversions. In dry-run mode it logs candidates so you can review; once you're confident, switch ADD_KEYWORDS to true and re-run to write the new exact-match keywords directly into the matching ad groups.
Setup
- 1Create a new script in Google Ads Scripts (Tools → Bulk Actions → Scripts → +).
- 2Paste the code and run it once in preview mode to review candidate keywords in the logs.
- 3Tune MIN_CONVERSIONS to a threshold that makes sense for your account volume.
- 4Optionally set MAX_CPA to skip high-CPA queries (0 = ignore CPA).
- 5When satisfied with the candidates, set ADD_KEYWORDS = true and run again to apply.
- 6Schedule weekly so newly converting terms are captured automatically.
Configuration Variables
| Variable | Default |
|---|---|
ADD_KEYWORDS | false |
MIN_CONVERSIONS | 1 |
MAX_CPA | 0 |
DATE_RANGE | LAST_30_DAYS |
SIMILARITY_THRESHOLD | 0.85 |
Expected Output
=== Search Term Harvester === 2 search term(s) meet the conversion threshold. CANDIDATE: [winter running shoes] Conv: 3 CPA: $18.50 AdGroup: Running Footwear SKIP (similar): [trail runner] AdGroup: Trail Running Summary: 1 candidate(s) | 1 skipped Set ADD_KEYWORDS = true to apply changes.
Notes
Before adding a term the script compares it against every existing keyword in the target ad group using a Levenshtein-distance similarity ratio. Any candidate scoring at or above SIMILARITY_THRESHOLD is skipped, so near-duplicates (e.g. singular/plural or minor spelling variants) are not added. Comparison is case-insensitive and ignores match-type punctuation.