PMax Search Term N-Grams
Breaks Performance Max search terms into word combinations with aggregated metrics, giving you n-gram-level visibility into PMax queries that PMax reporting hides.
by Charles Bannister (shabba.io)·shabba.io/google_ads_scripts/pmax-search-term-ngrams
Overview
Pulls Performance Max search-term insights and aggregates them into 1/2/3-word n-grams with metrics, so patterns of waste or intent become visible despite PMax's limited native reporting. Output lands in a Google Sheet, optionally segmented by campaign. Use it to inform PMax exclusions and brand/non-brand splits.
Setup
- 1Copy the Google Sheet template linked on the source page.
- 2In Google Ads, go to Tools → Bulk Actions → Scripts.
- 3Click + to create a new script and paste the code below.
- 4Set SPREADSHEET_URL. Adjust LOOKBACK_DAYS, the MIN_* filters and campaign-name filters.
- 5Authorize, preview, then schedule weekly.
Configuration Variables
| Variable | Default |
|---|---|
SPREADSHEET_URL | YOUR_SPREADSHEET_URL_HERE |
LOOKBACK_DAYS | 30 |
CURRENCY_SYMBOL | $ |
SEGMENT_BY_CAMPAIGN | false |
ENABLED_CAMPAIGNS_ONLY | true |
Expected Output
Pulled PMax search-term insights over 30 days. Aggregated 1/2/3-word n-grams (account-wide or per campaign). Tables written to the sheet with impressions, clicks, cost, conversions.
Notes
Performance Max only surfaces search-term insights (not full search-term reports), so coverage reflects what Google exposes for PMax. Requires a copied Google Sheet template for output.