gpagespeed

Analyze a webpage with Google PageSpeed

#gpagespeed

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

You must acquire an API key from Google Developers Console.

If you want a nice formatted report try psi by Addy Osmani.

##Installation

$ npm install gpagespeed

or globally for the CLI app

$ npm install gpagespeed -g

##Usage - Module

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.

var pagespeed = require('gpagespeed')
  , opts = {
    url: 'http://url-to-check',
    key: 'insert-your-key'
  };
 
pagespeed(opts, function(errdata){
  if(err) throw err;
 
  console.log(data);
});

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

var pagespeed = require('gpagespeed')
  , opts = {
    url: 'http://url-to-check',
    key: 'insert-your-key',
    userequest: true,
    apiversion: 'v3beta1'
  };
 
pagespeed(opts, function(errdata){
  if(err) throw err;
 
  console.log(data);
});

##Usage - CLI

$ gpagespeed <url> --key=<key>

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

$ gpagespeed <url> --key=<key> --callback=<callback> --prettyprint=<true> --userIp=<userIp> --locale=<locale> --strategy=<desktop|mobile>

In addition you can use flags to select another version of the api (defaults to v1) and to use request instead of googlapis.

$ gpagespeed <url> --key=<key> --userequest=true --apiversion=<versionstring>

##License MIT