GoogleAPIsPageSpeedInsights.run()

Run PageSpeed analizer

Usage

Hover over inputs/exits for more info.

var GoogleAPIsPageSpeedInsights = require('machinepack-googleapispagespeedinsights');


// Run PageSpeed analizer

GoogleAPIsPageSpeedInsights.run({

url: 'http://google.com',

key: 'YOUR_API_KEY',

filterThirdPartyResources: true,

locale: 'en',

screenshot: true,

rule: 'test',

fields: 'formattedResults,id,invalidRules,kind,pageStats,responseCode,ruleGroups,screenshot,title,version/major,version/minor',

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// OK.

success: function () {

 

},

});

Inputs

url required

URL of the resource you need to analize

'http://google.com'
key

Your API key

'YOUR_API_KEY'
filterThirdPartyResources

Indicates if third party resources should be filtered out before PageSpeed analysis

true
locale

The locale used to localize formatted results

'en'
screenshot

Indicates if binary data containing a screenshot should be included

true
rule

A PageSpeed rule to run; if none are given, all rules are run

'test'
fields

Selector specifying which fields to include in a partial response

'formattedResults,id,invalidRules,kind,pageStats,responseCode,ruleGroups,screenshot,title,version/major,version/minor'

Exits

error

An unexpected error occurred.

success

OK.