Skip to main content

PageSpeed Insights Integration Demo

This is what the PageSpeed Insights integration looks like when displaying real Google data. Below you'll see two examples: excellent performance and average performance.

Example 1: Excellent Performance

This is what a well-optimized site looks like. Notice the green scores, fast Core Web Vitals, and minimal optimization opportunities. This is the target for all Optymizer client sites.

PageSpeed Insights

Analyzed: 1/16/2026, 9:48:18 PM

URL: https://optymizer.com

performance
95
accessibility
98
Best Practices
92
seo
100

Core Web Vitals (Lab Data)

LCP
1.20s
Largest Contentful Paint
CLS
0.050
Cumulative Layout Shift
FCP
800ms
First Contentful Paint
TTI
2.10s
Time to Interactive
TBT
150ms
Total Blocking Time
SI
1.50s
Speed Index

Real User Data (Chrome UX Report)

LCP: 1400ms FAST
FID: 50ms FAST
CLS: 0.060 FAST

Top Opportunities

Eliminate render-blocking resources

Resources are blocking the first paint of your page. Consider delivering critical JS/CSS inline and deferring all non-critical JS/styles.

Potential savings
420ms
Properly size images

Serve images that are appropriately-sized to save cellular data and improve load time.

Potential savings
320ms
Minify JavaScript

Minifying JavaScript files can reduce payload sizes and script parse time.

Potential savings
180ms

Example 2: Average Performance (Needs Work)

This is what many sites look like - yellow and red scores indicating performance issues. Notice the longer Core Web Vitals times and significant optimization opportunities with real time savings potential.

PageSpeed Insights

Analyzed: 1/16/2026, 9:48:18 PM

URL: https://example.com

performance
65
accessibility
82
Best Practices
75
seo
90

Core Web Vitals (Lab Data)

LCP
3.20s
Largest Contentful Paint
CLS
0.180
Cumulative Layout Shift
FCP
2.10s
First Contentful Paint
TTI
4.50s
Time to Interactive
TBT
850ms
Total Blocking Time
SI
3.80s
Speed Index

Top Opportunities

Reduce server response times (TTFB)

Time To First Byte is too slow. Consider using a CDN, optimizing server code, or upgrading hosting.

Potential savings
1.20s
Eliminate render-blocking resources

Resources are blocking the first paint of your page.

Potential savings
980ms
Properly size images

Serve images that are appropriately-sized.

Potential savings
850ms
Enable text compression

Text-based resources should be served with compression (gzip, deflate or brotli).

Potential savings
720ms
Remove unused CSS

Remove dead rules from stylesheets and defer the loading of CSS not used for above-the-fold content.

Potential savings
650ms

How the Integration Works

Build-Time Analysis

The PageSpeed API is called during the Astro build process, not on every page load. This means zero performance impact for your visitors and efficient use of API quota.

Graceful Error Handling

If the API is unavailable or rate-limited, the page continues to build successfully without the PageSpeed section. No broken pages, just a missing optional feature.

Optional API Key

Works without authentication (~400 req/min). Add a Google API key to get higher limits (25,000 req/day). Perfect for development without keys, production with keys.

Smart Caching

Results are cached in the built HTML. When serving the page, browsers can cache it for hours. Only re-analyze on deployment, not on every visit.

Usage Examples

1. Simple Page Analysis

---
import { fetchPageSpeedData } from '@/utils/pagespeed';
import PageSpeedCard from '@/components/PageSpeedCard.astro';

const data = await fetchPageSpeedData({
  url: 'https://optymizer.com',
  strategy: 'mobile'
});
---

<PageSpeedCard data={data} />

2. Quick Score Check

import { getPerformanceScore } from '@/utils/pagespeed';

const score = await getPerformanceScore('https://optymizer.com');
console.log(`Performance: ${score}/100`);

3. Batch URL Analysis

import { batchAnalyzeUrls } from '@/utils/pagespeed';

const urls = [
  'https://optymizer.com',
  'https://optymizer.com/services/seo',
  'https://optymizer.com/about'
];

const results = await batchAnalyzeUrls(urls, {
  strategy: 'mobile'
}, 1000); // 1 second delay between requests

Ready to Optimize Your Site?

These scores don't lie. Faster sites rank higher, convert better, and cost less to run. Let's get your site into the green zone.