PageSpeed Insights Audit
Runs your top-spending landing pages through Google PageSpeed Insights (mobile) and flags the slow ones — page speed is a Quality Score component and a conversion killer.
by Google (original concept), chiliad (rewrite)·web.archive.org/web/20231003054446/https://developers.google.com/google-ads/scripts/docs/solutions/mobile-pagespeed
Overview
PageSpeed Insights Audit picks your top landing pages by ad spend and runs each through Google's PageSpeed Insights API with the mobile strategy, reporting the performance score and Largest Contentful Paint per page. Pages below your score threshold are flagged and emailed. Testing by spend means the pages costing you the most money get tested first — a slow page with real budget behind it is a compounding loss.
Setup
- 1Get a free PageSpeed Insights API key: https://developers.google.com/speed/docs/insights/v5/get-started
- 2Open your Google Ads account and go to Tools → Bulk Actions → Scripts.
- 3Click the + button to create a new script and paste the code below.
- 4Set API_KEY, and adjust PAGES_TO_TEST (PSI takes ~10-20s per page).
- 5Set EMAIL_ADDRESS to receive the slow-pages list, then schedule weekly.
Configuration Variables
| Variable | Default |
|---|---|
API_KEY | (empty) |
DATE_RANGE | LAST_30_DAYS |
PAGES_TO_TEST | 10 |
SCORE_ALERT | 50 |
EMAIL_ADDRESS | (empty) |
Expected Output
Testing 10 top landing pages via PageSpeed Insights (mobile)... https://example.com/bestseller score: 78/100 LCP: 2.1 s spend: 3105.20 https://example.com/category/shoes score: 41/100 LCP: 4.8 s spend: 1840.10 === PageSpeed Audit: 1 of 10 pages below score 50 === Email sent to you@example.com
Notes
Lab scores vary run to run — treat below-40 as definitely slow, 40-60 as worth investigating, and trends as more meaningful than single runs. Each PSI call takes 10-20 seconds, so keep PAGES_TO_TEST within the script's 30-minute limit (10-30 pages is safe).