Google PageSpeed Insights v5, CrUX Lab & Admin Speed Column
Encrypt your Google PageSpeed API key, benchmark Cached vs Uncached performance side by side, and inspect Mobile/Desktop scores inside Posts, Pages & WooCommerce Products with 0 SQL queries.
- Encrypts your free Google PageSpeed Insights API key at rest (
PageSpeedStore.php,kadicache_pagespeed_key_v1)—and supportsKADICACHE_PAGESPEED_API_KEYinwp-config.phpor Multisite network-wide sharing. - Runs official Google PageSpeed Insights v5 + 28-Day CrUX audits with optional Cached vs Uncached speedup comparison (
PageSpeedBypass.php) and warm-before-scan protection. LighthouseReportDistiller.phpmaps failing Lighthouse opportunities directly to the exact KadiCache toggle that fixes each audit—storing up to30distilled reports on disk (0DB bloat).PostListSpeed.phpadds a 0-SQL-querySpeedcolumn toPosts,Pages, andWooCommerce Productstables showing Mobile/Desktop scores plus live RUMp75 LCPratings.
Auditing Pages Right Inside WordPress Without Leaving Admin#
Copy-pasting URLs back and forth into pagespeed.web.dev—and trying to guess which WordPress setting fixes each Lighthouse warning—wastes hours every week for agency engineers and store owners. Worse, auditing a freshly edited post before its page cache is warm measures a cold PHP miss rather than what 99% of visitors actually receive!
KadiCache’s built-in PageSpeed & CrUX Lab (PageSpeedClient.php, PageSpeedStore.php, LighthouseReportDistiller.php, and PostListSpeed.php) brings official Google PageSpeed Insights API v5 and 28-day Chrome UX Report (CrUX) testing straight into WP Admin -> KadiCache -> Core Web Vitals—in 100% Free Core.
Step 1: Connecting & Encrypting Your Free Google PageSpeed API Key#
Google provides a 100% free PageSpeed Insights API key (25,000 queries/day quota) from Google Cloud Console. KadiCache supports three flexible ways to supply that key (PageSpeedStore::config()):
| Configuration Method | How to Set It Up | Best For |
|---|---|---|
| 1. WP Admin UI (Encrypted) | Paste key in Core Web Vitals -> PageSpeed & CrUX Lab & click Verify & Save | Single sites (encrypted at rest via sodium_crypto_secretbox + masked in UI) |
2. wp-config.php Constant | define('KADICACHE_PAGESPEED_API_KEY', 'AIzaSy...'); | Git/Bedrock deployments, CI/CD environments & agency starter stacks |
| 3. Multisite Network Key | Save once in Network Admin -> KadiCache -> Shared Configuration | Multisite networks (PageSpeedStore::saveNetworkKey() shares quota cleanly across subsites) |
When you click Verify & Save, KadiCache validates both Lighthouse v5 and CrUX API readiness (PageSpeedStore::saveCruxStatus()) and automatically tracks quota_backoff_until if Google ever returns HTTP 429.
Step 2: Running Warm Before Scan & Cached vs Uncached Comparisons#
Inside PageSpeed & CrUX Lab, two built-in engineering features eliminate misleading benchmark numbers:
- Automatic Warm-Before-Scan (
warm_before_scan = true): Before calling Google’s remote Lighthouse servers, KadiCache performs a fast anonymous loopback warmup on the target URL so Google measures your warm cached HTML (X-KadiCache: HIT) rather than an accidental cold cache miss. - With-vs-Without KadiCache Benchmark (
compare_bypassviaPageSpeedBypass.php): Toggle Compare Cached vs Uncached to benchmark your optimized page side-by-side against a signed, short-lived unoptimized baseline token. You get an instant before/after delta card (TTFB,FCP,LCP,TBT,CLS, andPerformance Scoregain) ready for client reports! - Actionable Opportunity Mapping (
LighthouseReportDistiller.php): Instead of dumping 4 MB of raw Lighthouse JSON intowp_options,LighthouseReportDistillerextracts scores, Core Web Vitals, LCP target element HTML/selector, and failing audits—linking each warning (Reduce unused CSS,Defer offscreen images,Eliminate render-blocking resources) directly to the KadiCache tab that solves it! Up to30distilled reports and25history snapshots are stored in flat files (PageSpeedFileRepository.php) with zero database table bloat.
Step 3: Using the Zero-SQL-Query Speed Column in Posts, Pages & Products (PostListSpeed.php)#
Once your API key or RUM collector is active, open WP Admin -> Posts, Pages, or Products (WooCommerce):
- Zero Database Queries per Row:
PostListSpeed::renderColumn()reads memoized score indexes (PageSpeedStore::scoreForUrl(), capped at300indexed URLs in memory) plus live RUM path summaries (RumStore::pathSummaryForUrl())—adding0SQL queries to WordPress admin list tables! - Smart Draft & Password Guards: Drafts and password-protected posts automatically display a muted
DraftorProtectedbadge with an explanation tooltip instead of wasting API calls on non-public URLs. - 1-Click Row Re-Audit Modal: Hover any published post, page, or WooCommerce product and click Test Speed (or click its score badge) to open the Quick Speed Inspector modal and run a fresh Mobile + Desktop audit on the spot.
- Custom Post Type Filter: Developers can customize which public post types display the
Speedcolumn via thekadicache_pagespeed_post_typesPHP filter.
// 1. Define your PageSpeed API key in wp-config.php (optional)
define('KADICACHE_PAGESPEED_API_KEY', 'AIzaSyYourGoogleCloudKeyHere');
// 2. Limit the Admin Speed Column to Pages and WooCommerce Products (optional)
add_filter('kadicache_pagespeed_post_types', static function (array $types): array {
return array_values(array_intersect($types, ['page', 'product']));
});How Mapped Opportunity Cards Accelerate Client Reporting#
When an agency manages 25 client sites, translating raw Google Lighthouse JSON diagnostics into plain-English action items saves hours during monthly maintenance reviews:
- Direct Audit-to-Setting Mapping: When
LighthouseReportDistiller.phpseesrender-blocking-resources,unused-css-rules,offscreen-images,uses-webp-images, orserver-response-time, each card links straight to the exact KadiCache control (CSS & JavaScript,Lazyload,Images, orCache) rather than leaving editors to search Google. - Disk-Capped Report Retention (
MAX_REPORTS = 30,MAX_HISTORY = 25): Stored inside KadiCache’s file repository (PageSpeedFileRepository.php) with exclusive file locking (PageSpeedStore::withLock()), historical score trends survive plugin updates without adding a single row towp_postmeta. - MCP & Headless Audit Trigger (
run_pagespeed_audit): You can also trigger Mobile and Desktop audits programmatically from Claude Code, Cursor, or KadiCache Pulse (compare_bypass: true) right after deploying a theme update.
Frequently Asked Operational Questions
Does Google charge money for a PageSpeed Insights API key?
Is my PageSpeed API key exposed in browser JavaScript or exported settings JSON?
Does the Speed column slow down WP Admin when viewing 100 WooCommerce products?
Why does CrUX field data say "Insufficient real-user data" on a brand-new domain?
Can I schedule automatic weekly or daily homepage PageSpeed tracking?
Creator of KadiCache’s Early PHP Drop-In, 7-Driver Object Cache Engine, Cloud Remove Unused CSS, and Zero-CLS Lazy Render pipeline.