Skip to content
Node.js module/CLI app for analyzing a webpage using Google PageSpeed
JavaScript
Branch: master
Clone or download
Latest commit 32665be Jan 18, 2020
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
test standard --fix (patch) Sep 16, 2018
.gitignore Adds package-lock (patch) Oct 14, 2019
.travis.yml Updates engines to 10 LTS (major) Nov 16, 2018
LICENSE Initial commit Apr 12, 2014
README.md Updates engines (patch) Sep 16, 2018
index.js
package-lock.json
package.json 6.0.12 Jan 18, 2020
renovate.json
return-example.md

README.md

Build Status js-standard-style

gpagespeed

Node.js module for analyzing a webpage with Google PageSpeed Insights.

You must acquire an API key from Google Developers Console.

Usage

Pass an object with properties.

url and key are required, all other are optional.

You can see a list of all alternatives on the page for Google PageSpeed standard query parameters.

const pagespeed = require('gpagespeed')
const options = {
  url: 'http://url-to-check',
  key: 'insert-your-key'
}

pagespeed(options)
  .then(data => {
    console.log(data)
  })
  .catch(error => {
    console.error(error)
  })

Alternative api

In addition you can choose to use https instead of googleapis and another version of the PageSpeed api (defaults to v4).

const pagespeed = require('gpagespeed')
const options = {
  url: 'http://url-to-check',
  key: 'insert-your-key',
  useweb: true,
  apiversion: 'v3beta1'
}

pagespeed(options)
  .then((data) => {
    console.log(data)
  })
  .catch((error) => {
    console.error(error)
  })

Returns

return-example.md

Related

License

MIT

You can’t perform that action at this time.