Features
xSpeed Hub Pricing Docs Blog Scan
Appearance
Get Plugin

PageSpeed Insights Integration

Health & insights 6 min read

xSpeed Cache can run Google PageSpeed Insights audits on your pages from inside the dashboard. You get a performance score and the top issues to fix, without leaving WordPress.

What this does

This panel calls Google’s PageSpeed Insights (PSI) API on demand for a URL you choose. It then shows:

  • A performance score from 0 to 100.
  • Core Web Vitals and lab metrics for the page: LCP, FCP, CLS, TBT (Total Blocking Time), Speed Index, and TTFB.
  • The top issues, ranked by how much time they could save.

Each result is cached for 24 hours per URL and strategy pair, so re-showing the last audit does not spend more of your quota. You can force a fresh run when you want one.

Why use it

PageSpeed Insights is the lab audit Google publishes for measuring page performance. Running it from the dashboard keeps your testing in one place and lets you re-check a page after changing cache or optimization settings.

Requirements

  • xSpeed Cache Pro must be active. The PageSpeed Insights integration is a Pro feature.
  • An internet connection, since the audit runs on Google’s servers.
  • A Google PSI API key is recommended. Audits technically work without one, but the keyless path shares a single site-wide allowance with everyone else using it, so it frequently returns limit-exceeded errors. The key is free and takes about a minute to create, see How to get a free PSI API key below.

How to run an audit

  1. Open the xSpeed Cache dashboard and go to the PageSpeed panel (the gauge icon).
  2. Choose the URL to audit. The site home page is used if you do not specify one.
  3. Pick a strategy, Mobile or Desktop. Mobile is the default.
  4. Run the audit. The score, metrics, and top issues appear when Google responds.
  5. To get fresh numbers within the 24-hour cache window, force a new run.

The URL must include http:// or https://.

Settings explained

SettingWhat it doesDefault
PageSpeed Insights API Key (recommended)Your own Google PSI key. Free, and raises the request limit to 25,000 per day.Empty
Default StrategyWhether audits default to Mobile or Desktop.Mobile

PageSpeed Insights API Key (recommended). Audits run without a key, but Google rate-limits anonymous calls to roughly one request per second, and that allowance is shared across everyone calling the API anonymously, not just you. In practice this means keyless audits fail with a quota or rate-limit error often enough that most people hit one before they realise a key would have prevented it. Your own free key raises the limit to about 25,000 requests per day, all to yourself.

Default Strategy. Google ranks pages on their mobile experience, so Mobile is the recommended default. You can still override the strategy for an individual audit from the dashboard.

How to get a free PSI API key

PageSpeed Insights API keys are free. Google gives you 25,000 queries per day at no cost, and there is no paid tier. This is simply the quota everyone gets.

The quickest route is Google’s own setup tool:

  1. Sign in to Google. Use the account you want the project to belong to.
  2. Open the developer docs. Go to Get Started with the PageSpeed Insights API.
  3. Generate the key. Scroll to Acquiring and using an API key and click Get a Key.
  4. Pick a project. Choose an existing one, or select + Create a new project, then Next.
  5. Copy the key and paste it into the API key field in the PageSpeed panel.

Alternative: the Google Cloud Console

Use this route if you want more control over the key, or already manage other Google Cloud services:

  1. Open the Google Cloud Console and create or select a project.
  2. Go to Menu → APIs & Services → Library.
  3. Search for PageSpeed Insights API and click Enable.
  4. Go to Menu → APIs & Services → Credentials.
  5. Click Create Credentials, then API key.
  6. The key appears immediately.

Restrict the key

Worth doing, and it takes a moment. In the Cloud Console, click Edit API key and set:

  • Application restrictions. HTTP referrers, limited to your own site.
  • API restrictions, limit the key so it can only call the PageSpeed Insights API.

An unrestricted key that leaks can be used by anyone who finds it, and they will spend your daily quota. Restricting it costs nothing and removes that risk.

Reading the result

  • Score (0–100). Google’s overall performance score for the page. Higher is better.
  • Metrics. LCP, FCP, CLS, TBT, Speed Index, and TTFB, in milliseconds (CLS is unitless). A metric may show as not available if Google did not return it.
  • Top issues: the audits with the biggest potential savings, each with a title, a description, and an estimated time saving in milliseconds. The dashboard surfaces the top few with an option to see more.

Note: Results are cached for 24 hours per URL and strategy. If you run the same URL and strategy again within that window, you get the cached result unless you force a fresh run.

Best practices

  • Add your own free API key before you start. It takes a minute and it is the difference between audits that run and audits that intermittently fail on someone else’s quota.
  • Audit on Mobile first, since that is what Google uses for ranking.
  • Re-run an audit after changing cache or optimization settings to see the effect. Force a fresh run so you are not reading the cached score.
  • Work through the top issues in order. They are sorted by estimated savings.

Troubleshooting

The audit fails or times out. The audit runs on Google’s servers and depends on your site being reachable from the internet. Local or password-protected sites cannot be audited. Check the error message returned in the result.

I am getting rate-limited, or a quota error. You are almost certainly running without an API key. Anonymous PSI calls draw on an allowance shared across all anonymous callers, so it can be exhausted by traffic that has nothing to do with your site, the error appears at random and is not something you can wait out reliably. Add your own free API key.

The score did not change after I made a fix. Results are cached for 24 hours. Force a fresh run to re-audit the page.

A metric shows as not available. Google did not return that metric for this page. Try re-running the audit.

FAQ

Do I need an API key? Strictly speaking, no. Audits will run without one. In practice you want one. The keyless path draws on an allowance shared with every other anonymous caller, so it returns limit-exceeded errors unpredictably, including on your very first audit. The key is free, has no paid tier to upgrade to, and takes about a minute to create.

Mobile or Desktop: which should I use? Mobile, in most cases. Google ranks on the mobile experience. Use Desktop when you specifically want to check the desktop view.

How is this different from Real-User Monitoring? PageSpeed Insights is a single lab audit you run on demand. Real-User Monitoring measures real visitors over time. Use both for a full picture.