There are gear to lend a hand track web page efficiency and assess your enhancements. Some of the ideal is PageSpeed Insights. It’s to be had as a internet software and because the Lighthouse tab in Chrome’s DevTools (the similar DevTools also are to be had in Edge, Opera, Courageous, and Vivaldi).

Internet web page efficiency is extra essential than ever. Customers be expecting a slick and responsive revel in that competitors desktop programs. As well as, Google’s Core Internet Vitals measure web page efficiency – it influences PageRank and your Seek Engine Optimization efforts.

WordPress runs greater than a 3rd of all internet sites however efficiency is affected by means of useless webhosting, sluggish issues, and an over-reliance on plugins. You’ll repair maximum issues by means of switching to a just right internet host and the usage of ideal follow efficiency tactics.

Gaining access to Lighthouse

Get started Lighthouse by means of opening the web page you wish to have to inspect and urgent Ctrl/Cmd + Shift + I or opting for Developer Gear from Extra gear within the menu. Transfer to the Lighthouse tab and click on the Analyse Web page Load button. Effects are proven after a couple of seconds:

Example Lighthouse report
Instance Lighthouse record

You’ll drill down into the top-level percentages to find additional knowledge and hints which deal with identified issues. The software is worthwhile however there are downsides:

  • You should manually get started a run for each and every web page you’re trying out.
  • It isn’t simple to report how elements have advanced or worsened over the years.
  • There may be numerous information to test and it’s simple to get one thing improper.
  • The technical main points are supplied for builders. It’s in all probability overwhelming for shoppers and bosses who need a fast review of development.
  • Lighthouse runs will also be influenced by means of native instrument and community speeds which might result in false assumptions.

The PageSpeed Insights API supplies a approach to resolve those problems so exams will also be automatic, recorded, and when compared.

What Is the PageSpeed Insights API?

Google supplies a loose PageSpeed Insights REST API which returns information in JSON layout containing the entire Lighthouse metrics and extra. It permits you to automate web page runs, retailer the ensuing information, evaluation adjustments over the years, and show the precise knowledge you wish to have.

The PageSpeed Insights API emulates how Google sees your web site. It is advisable run a record each and every few days or every time you unencumber a efficiency replace.

The effects are useful however now not essentially indicative of tangible consumer revel in. The browser Efficiency API is a more sensible choice when you wish to have to observe real-world efficiency throughout your entire consumer’s units and networks.

WordPress web site now not on top of things? Deficient webhosting, issues, and plugins may well be the culprits! 😩 Optimize your web site with PageSpeed Insights and take your site to the following point! 🚀Click on to Tweet

PageSpeed Insights API Quickstart

Reproduction the next deal with in your internet browser and edit the url to evaluate the efficiency of your web page:

Firefox is perfect as it has a integrated JSON viewer even if Chrome has extensions that give you the similar capability. The total Lighthouse Efficiency ranking is highlighted underneath:

PageSpeed Insights API result JSON (Firefox)
PageSpeed Insights API consequence JSON (Firefox)

You’ll alternate the API URL question string in your personal pages and personal tastes. The one required parameter is url, e.g.


A desktop check is administered by means of default however you’ll be able to explicitly request it with:


or transfer to cell with:


Simplest efficiency exams are run except you specify a number of classes of passion:

class=website positioning

A particular language will also be outlined by means of atmosphere a locale – similar to French:


and Google Analytics marketing campaign main points will also be set with:


The carrier is loose for occasional requests however it is important to sign-up for a Google API key in case you intend to run many exams from the similar IP deal with in a brief length. The bottom line is added to the URL with:


You’ll construct the URL’s question string by means of specifying your selected parameters separated with ampersand (&) characters. The next API URL exams the web page at the usage of a cell instrument to evaluate efficiency and accessibility standards:

You’ll assemble your personal URLs or use the Google PageSpeed API URL builder software must you require additional help.

PageSpeed Insights API JSON Effects

Checks will in most cases go back round 600Kb of JSON information relying to your selected classes, the choice of belongings within the web page, and the complexity of screenshots (embedded in base64 layout).

The amount of knowledge is daunting, there’s some duplication, and the effects documentation isn’t at all times transparent. The JSON is divided into 4 sections as described underneath.


Those are metrics calculated for the top consumer’s web page loading revel in. It comprises knowledge such because the Core Internet Vitals CUMULATIVE_LAYOUT_SHIFT_SCORE, FIRST_CONTENTFUL_PAINT_MS, and FIRST_INPUT_DELAY_MS. Main points and a “class” worth returns FAST, AVERAGE, SLOW, or NONE if no dimension used to be taken. Instance:

"loadingExperience": {
"metrics": {
"percentile": 0,
"distributions": [
"min": 0,
"max": 10,
"proportion": 0.970
"min": 10,
"max": 25,
"proportion": 0.017
"min": 25,
"proportion": 0.012
"class": "FAST"


Those are aggregated metrics calculated for all customers’ web page loading reports. The sections are similar to loadingExperience above and websites with much less visitors are not going to turn any distinction in figures.


That is the biggest segment and incorporates all Lighthouse metrics. It supplies details about the check:

  • requestedUrl – the URL you asked
  • finalUrl – the true web page examined after following all redirects
  • lighthouseVersion – the instrument model
  • fetchTime – the time the check used to be run
  • userAgent – the consumer agent string of the browser used for the check
  • surroundings – prolonged consumer agent knowledge
  • configSettings – the settings handed to the API

That is adopted by means of an “audits” segment with many sections together with unused-javascript, unused-css-rules, total-byte-weight, redirects, dom-size, largest-contentful-paint-element, server-response-time, network-requests, cumulative-layout-shift, first-meaningful-paint, screenshot-thumbnails, and full-page-screenshot.

Maximum audit metrics supply a “main points” segment which incorporates elements similar to “overallSavingsBytes” and “overallSavingsMs” which estimates some great benefits of enforcing a efficiency growth.

The whole web page and thumbnail “screenshot” sections comprise embedded base64 symbol information.

A  “metrics” segment supplies a abstract of all metrics in an “pieces” array, e.g.

"metrics": {
"identity": "metrics",
"identify": "Metrics",
"description": "Collects all to be had metrics.",
"ranking": null,
"scoreDisplayMode": "informative",
"main points": {
"kind": "debugdata",
"pieces": [{
"observedFirstVisualChange": 234,
"observedFirstContentfulPaint": 284,
"interactive": 278,
"observedFirstPaintTs": 1579728174422,
"observedDomContentLoaded": 314,
// ... etc ...
"numericValue": 278,
"numericUnit": "millisecond"

The “audits” segment is adopted by means of “classes” which supplies total Lighthouse ratings for the selected classes handed at the API URL:

"classes": {
"efficiency": {
"identity": "efficiency",
"identify": "Efficiency",
"ranking": 0.97,
"auditRefs": [

The “ranking” is a bunch between 0 and 1 which is in most cases proven as a proportion on Lighthouse stories. Generally, a ranking of:

  • 0.9 to one.0 is just right
  • 0.5 to below 0.9 signifies growth is vital
  • below 0.5 is deficient and calls for extra pressing consideration

The “auditRefs” segment supplies a listing of all metrics and the weightings used to calculate every ranking.


After all, the research time is reported. This must be similar to the time proven in lighthouseResult.fetchTime.

Helpful JSON Consequence Metrics

I like to recommend you save and read about the JSON lead to a textual content editor. Some have JSON formatters integrated or to be had as plugins. Then again, you’ll be able to use loose on-line gear similar to:

The next metrics usually are helpful. Consider to set the related class choices at the URL as vital.

Abstract Metrics

Total ratings from 0 to one:

Efficiency lighthouseResult.classes.efficiency.ranking
Accessibility lighthouseResult.classes.accessibility.ranking
search engine marketing positioning.ranking
Innovative Internet App (PWA) lighthouseResult.classes.pwa.ranking

Efficiency Metrics

Those come with Core Internet Vitals ratings from 0 to one:

First Contentful Paint lighthouseResult.audits.first-contentful-paint.ranking
First Significant Paint lighthouseResult.audits.first-meaningful-paint.ranking
Greatest Contentful Paint lighthouseResult.audits.largest-contentful-paint.ranking
Pace Index lighthouseResult.audits.speed-index.ranking
Cumulative Format Shift lighthouseResult.audits.cumulative-layout-shift.ranking

Different helpful efficiency ratings come with:

Server reaction time lighthouseResult.audits.server-response-time.ranking
Is crawlable
Console mistakes lighthouseResult.audits.errors-in-console.ranking
Overall byte weight
DOM length ranking lighthouseResult.audits.dom-size.ranking

You’ll most often download precise figures and gadgets similar to:

  • –
    the overall web page length, e.g. 450123
  • –
    the gadgets used for the overall web page length, e.g. “byte”

Then again, “displayValue” most often incorporates a readable message with each the determine and unit:

  • lighthouseResult.audits.server-response-time.displayValue –
    a message in regards to the reaction time, e.g. “Root report took 170 ms”
  • lighthouseResult.audits.dom-size.displayValue –
    a message about choice of parts within the DOM, e.g. “543 parts”

Create a No-Code Efficiency Dashboard

Are living API feeds will also be learn and processed in lots of programs together with Microsoft Excel. (Moderately bizarrely, Google Sheets does now not enhance JSON feeds with out additional plugins or macro code. It does enhance XML.)

To import the reside total efficiency ranking into Excel, get started a brand new spreadsheet, transfer to the Knowledge tab, and click on From Internet. Input your PageSpeed Insights API URL and hit OK:

Excel From Web data import
Excel From Internet information import

Click on Attach within the subsequent conversation and stay the default (Nameless) atmosphere. You are going to continue to the Question Settings software:

Excel Query Settings Tool
Excel Question Settings Software

Click on Document at the appropriate of the lighthouse consequence metric. Then click on the similar on classes and efficiency to drill down the JSON object hierarchy:

Excel JSON object drill-down
Excel JSON object drill-down

Click on the Into Desk icon on the peak from the right-click menu choices.

You’ll then click on the clear out arrow within the desk heading to take away the whole thing rather than the ranking prior to clicking OK:

Excel imported table filtering
Excel imported desk filtering

After all, click on Shut & Load to turn the reside efficiency ranking for your spreadsheet:

Excel live data
Excel reside information

You’ll practice the similar procedure for different metrics of passion.

Create a Internet Efficiency Dashboard

This Codepen demonstration supplies a kind the place you’ll be able to input a URL and make a selection desktop or cell research to procure effects.

The code creates a PageSpeed Insights URL, calls the API, then renders more than a few effects right into a abstract desk which is faster to view than a typical Lighthouse record:

Example test result from PageSpeed API
Instance check consequence

The asynchronous startCheck() serve as is known as when the shape is submitted. It cancels the put up match and hides earlier effects:

// make API request
async serve as startCheck(e) {
display(resultTable, false);
display(error, false);

It then constructs apiURL from the shape information and disables the fields:

shape = e.goal,
fields = shape.firstElementChild,
information = new FormData(shape),
qs = decodeURIComponent( new URLSearchParams(information).toString() ),
apiURL = shape.motion + '?' + qs;
fields.disabled = true;

The Fetch API is used to name the PageSpeed URL, get the reaction, and parse the JSON string right into a usable JavaScript object. A check out/catch block guarantees disasters are captured:

  check out {
// name API and get consequence
reaction = look forward to fetch(apiURL),
consequence = look forward to reaction.json();

The end result object is handed to a showResult() serve as. This extracts houses and puts them into the end result desk or every other HTML detail which has data-point characteristic set to a PageSpeed API belongings, e.g.

The tip of the check out block:

    // output consequence
display(standing, false);

After all, a catch block handles mistakes and the shape fields are re-enabled so additional exams will also be run:

  catch(err) {
// API error
display(standing, false);
fields.disabled = false;

Additional Building Choices

The instance code above fetches a consequence from the PageSpeed Insights API while you request it. The record is extra configurable than Lighthouse however execution stays a guide procedure.

For those who intend to increase your personal dashboard, it can be sensible to create a small software that calls the PageSpeed Insights API and retail outlets the ensuing JSON in a brand new database report towards the examined URL and the present date/time. Maximum databases have JSON enhance even if MongoDB is preferably fitted to the duty. A cron task can name your software on a timed foundation – in all probability as soon as in line with day right through the early hours of the morning.

A server-side software can then put in force its personal REST API in your reporting necessities, e.g. go back the adjustments in explicit efficiency metrics between two dates. It may be referred to as by means of client-side JavaScript to show tables or charts that illustrate efficiency enhancements over the years.

If you wish to create advanced stories with vital amounts of knowledge, it’s preferable to pre-calculate the figures as soon as in line with day on the level new PageSpeed information is to be had. In spite of everything, you don’t wish to display how efficiency is bettering on a record which takes mins to generate!

Wish to spice up your site’s ratings and consumer revel in? See your web site via Google’s eyes with PageSpeed Insights API! Discover ways to track and optimize your web page’s efficiency like a professional 👀Click on to Tweet


Chrome’s Lighthouse software is fabulous however it’s a chore to regularly assessment many pages. The PageSpeed Insights API permits you to assess web site efficiency the usage of programmatic tactics. The advantages:

The submit How To Use the PageSpeed Insights API to Track Web page Efficiency gave the impression first on Kinsta®.

WP Hosting

[ continue ]