PageSpeed Insights

Reference

This Reference Guide is a detailed technical reference of the collections, resources, and methods for the PageSpeed Insights API v1.

Introduction

Contents and Overview

Data Method REST URI relative to https://www.googleapis.com/pagespeedonline/v1
PageSpeed Results runPagespeed GET  /runPagespeed

PageSpeed Results

The PageSpeed Results Resource contains a PageSpeed score, a list of suggestions to make that page faster, and other information described below.

By default, the response is returned as JSON. When the callback=functionName parameter is included in calls, the response is returned as JSONP.

runPagespeed

Runs PageSpeed analysis on the page at the specified URL, and returns a PageSpeed score, a list of suggestions to make that page faster, and other information.

This method requires the following query parameters: url, key. It also supports the following optional query parameters: locale, strategy, rule.

GET https://www.googleapis.com/pagespeedonline/v1/runPagespeed

Try it now in the APIs Explorer!


{
  "kind": "pagespeedonline#result",
  "id": (value),
  "responseCode": (value),
  "title": (value),
  "score": (value),
  "pageStats": {
    "numberResources": (value),
    "numberHosts": (value),
    "totalRequestBytes": (value),
    "numberStaticResources": (value),
    "htmlResponseBytes": (value),
    "textResponseBytes": (value),
    "cssResponseBytes": (value),
    "imageResponseBytes": (value),
    "javascriptResponseBytes": (value),
    "flashResponseBytes": (value),
    "otherResponseBytes": (value),
    "numberJsResources": (value),
    "numberCssResources": (value)
  },
  "formattedResults": {
    "locale": (value),
    "ruleResults": {
      
        (value): {
          "localizedRuleName": (value),
          "ruleImpact": (value),
          "urlBlocks": [
            {
              "header": {
                "format": (value),
                "args": [
                  {
                    "type": (value),
                    "value": (value)
                  }
                ]
              },
              "urls": [
                {
                  "result": {
                    "format": (value),
                    "args": [
                      {
                        "type": (value),
                        "value": (value)
                      }
                    ]
                  },
                  "details": [
                    {
                      "format": (value),
                      "args": [
                        {
                          "type": (value),
                          "value": (value)
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      
    }
  },
  "version": {
    "major": (value),
    "minor": (value)
  },
  "invalidRules": [
    (value)
  ]
}
Property Name Value Description
kind string Kind of result.
id string Canonicalized and final URL for the document, after following page redirects (if any).
responseCode integer Response code for the document. 200 indicates a normal page load. 4xx/5xx indicates an error.
title string Title of the page, as displayed in the browser's title bar.
score integer The PageSpeed Score (0-100), which indicates how much faster a page could be. A high score indicates little room for improvement, while a lower score indicates more room for improvement.
pageStats object Summary statistics for the page, such as number of JavaScript bytes, number of HTML bytes, etc.
pageStats.numberResources integer Number of HTTP resources loaded by the page.
pageStats.numberHosts integer Number of unique hosts referenced by the page.
pageStats.totalRequestBytes long Total size of all request bytes sent by the page.
pageStats.numberStaticResources integer Number of static (that is, cacheable) resources on the page.
pageStats.htmlResponseBytes long Number of uncompressed response bytes for the main HTML document and all iframes on the page.
pageStats.textResponseBytes long Number of uncompressed response bytes for text resources on the page that aren't covered by other statistics; that is, non-HTML, non-script, non-CSS resources.
pageStats.cssResponseBytes long Number of uncompressed response bytes for CSS resources on the page.
pageStats.imageResponseBytes long Number of response bytes for image resources on the page.
pageStats.javascriptResponseBytes long Number of uncompressed response bytes for JS resources on the page.
pageStats.flashResponseBytes long Number of response bytes for Flash resources on the page.
pageStats.otherResponseBytes long Number of response bytes for other resources on the page.
pageStats.numberJsResources integer Number of JavaScript resources referenced by the page.
pageStats.numberCssResources integer Number of CSS resources referenced by the page.
formattedResults object Localized PageSpeed results. Contains a ruleResults entry for each PageSpeed rule instantiated and run by the server.
formattedResults.locale string The locale of the formattedResults, such as en_US.
formattedResults.ruleResults object Dictionary of formatted rule results, with one entry for each PageSpeed rule instantiated and run by the server.
formattedResults.ruleResults.value object
The enum-like identifier for this rule, such as EnableKeepAlive or AvoidCssImport. Not localized.
formattedResults.ruleResults.(value).
localizedRuleName
string Localized name of the rule, intended for presentation to a user.
formattedResults.ruleResults.(value).ruleImpact double The impact (unbounded floating point value) that implementing the suggestions for this rule would have on making the page faster. Impact is comparable between rules to determine which rule's suggestions would have a higher or lower impact on making a page faster. For instance, if enabling compression would save 1MB, while optimizing images would save 500kB, the enable compression rule would have 2x the impact of the image optimization rule, all other things being equal.
formattedResults.ruleResults.(value).urlBlocks list List of blocks of URLs. Each block may contain a heading and a list of URLs. Each URL may optionally include additional details.
formattedResults.ruleResults.(value).urlBlocks.
header
object Heading to be displayed with the list of URLs.
formattedResults.ruleResults.(value).urlBlocks.
header.format
string A localized format string with $N placeholders, where N is the 1-indexed argument number. For example: 'Minifying the following $1 resources would save a total of $2 bytes'.
formattedResults.ruleResults.(value).urlBlocks.
header.args
list List of arguments for the format string.
formattedResults.ruleResults.(value).urlBlocks.
header.args.type
string Type of argument. One of URL, STRING_LITERAL, INT_LITERAL, BYTES, or DURATION.
formattedResults.ruleResults.(value).urlBlocks.
header.args.value
string Argument value, as a localized string.
formattedResults.ruleResults.(value).urlBlocks.
urls
list List of entries that provide information about URLs in the URL block. Optional.
formattedResults.ruleResults.(value).urlBlocks.
urls.result
object A format string that gives information about the URL, and a list of arguments for that format string.
formattedResults.ruleResults.(value).urlBlocks.
urls.result.format
string A localized format string with $N placeholders, where N is the 1-indexed argument number. For example: 'Minifying the resource at URL $1 can save $2 bytes'.
formattedResults.ruleResults.(value).urlBlocks.
urls.result.args
list List of arguments for the format string.
formattedResults.ruleResults.(value).urlBlocks.
urls.result.args.type
string Type of argument. One of URL, STRING_LITERAL, INT_LITERAL, BYTES, or DURATION.
formattedResults.ruleResults.(value).urlBlocks.
urls.result.args.value
string Argument value, as a localized string.
formattedResults.ruleResults.(value).urlBlocks.
urls.details
list List of entries that provide additional details about a single URL. Optional.
formattedResults.ruleResults.(value).urlBlocks.
urls.details.format
string A localized format string with $N placeholders, where N is the 1-indexed argument number. For example: 'Unnecessary metadata for this resource adds an additional $1 bytes to its download size'.
formattedResults.ruleResults.(value).urlBlocks.
urls.details.args
list List of arguments for the format string.
formattedResults.ruleResults.(value).urlBlocks.
urls.details.args.type
string Type of argument. One of URL, STRING_LITERAL, INT_LITERAL, BYTES, or DURATION.
formattedResults.ruleResults.(value).urlBlocks.
urls.details.args.value
string Argument value, as a localized string.
version object The version of the PageSpeed SDK used to generate these results.
version.major integer The major version number of the PageSpeed SDK used to generate these results.
version.minor integer The minor version number of the PageSpeed SDK used to generate these results.
invalidRules list List of rules that were specified in the request, but which the server did not know how to instantiate.


Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.