Description: Run Googles Page Speed Insights API
- Clone Repo using repo url
- Install package dependencies
npm install
-
Run the command
cp .env.example .env
to create a local.env
file -
Visit the Google Developers Credentials Page and create an API key. Paste this key into your
.env
file as thePAGE_SPEED_INSIGHTS_API_KEY=
-
Run the scripts in the
package.json
file
all
: runs theall-pages
test using the presetpages
select
: runs thepsi-checks
test allowing the user to select which page they'd like to test from the presetpages
choose
: runs thechoose-page
test that will prompt the user for a URL, LABEL, and repeat number
If you'd like to be able to run these tests on your own pages, all-pages.js
and psi-checks.js
both have objects (pages
) in them that you can update with a label and url
- Navigate to the
.js
file you'd like to update - Update the
pages
object, the KEY will be used as the label and the VALUE will be the tested url - Run the correlating script for that page
Googles Page Speed Insights API makes use of lighthouse scores, as well as their own Chrome User Experience report. This package is based on the initial setup documented in the javascript
implementation. The API returns a large amount of data that you can also add in as needed.