Pagespeedapi: runpagespeed

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

Request

HTTP request

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

Parameters

Parameter name Value Description
Required query parameters
url string The URL to fetch and analyze
Optional query parameters
category string A Lighthouse category to run; if none are given, only Performance category will be run

Acceptable values are:
  • "accessibility"
  • "best-practices"
  • "performance"
  • "pwa"
  • "seo"
locale string The locale used to localize formatted results
strategy string The analysis strategy (desktop or mobile) to use, and desktop is the default

Acceptable values are:
  • "desktop": Fetch and analyze the URL for desktop browsers
  • "mobile": Fetch and analyze the URL for mobile devices
utm_campaign string Campaign name for analytics.
utm_source string Campaign source for analytics.

Request body

Do not supply a request body with this method.

Response

If successful, this method returns a response body with the following structure:

{
  "captchaResult": string,
  "kind": "pagespeedonline#result",
  "id": string,
  "loadingExperience": {
    "id": string,
    "metrics": {
      (key): {
        "percentile": integer,
        "distributions": [
          {
            "min": integer,
            "max": integer,
            "proportion": double
          }
        ],
        "category": string
      }
    },
    "overall_category": string,
    "initial_url": string
  },
  "originLoadingExperience": {
    "id": string,
    "metrics": {
      (key): {
        "percentile": integer,
        "distributions": [
          {
            "min": integer,
            "max": integer,
            "proportion": double
          }
        ],
        "category": string
      }
    },
    "overall_category": string,
    "initial_url": string
  },
  "lighthouseResult": {
    "requestedUrl": string,
    "finalUrl": string,
    "lighthouseVersion": string,
    "userAgent": string,
    "fetchTime": string,
    "environment": {
      "networkUserAgent": string,
      "hostUserAgent": string,
      "benchmarkIndex": double
    },
    "runWarnings": [
      (value)
    ],
    "configSettings": {
      "emulatedFormFactor": string,
      "locale": string,
      "onlyCategories": (value),
      "onlyCategories": (value)
    },
    "audits": {
      (key): {
        "id": string,
        "title": string,
        "description": string,
        "score": (value),
        "score": (value),
        "scoreDisplayMode": string,
        "displayValue": string,
        "explanation": string,
        "errorMessage": string,
        "warnings": (value),
        "warnings": (value),
        "details": {
          (key): (value)
        }
      }
    },
    "categories": {
      (key): {
        "id": string,
        "title": string,
        "description": string,
        "score": (value),
        "score": (value),
        "manualDescription": string,
        "auditRefs": [
          {
            "id": string,
            "weight": double,
            "group": string
          }
        ]
      }
    },
    "categoryGroups": {
      (key): {
        "title": string,
        "description": string
      }
    },
    "runtimeError": {
      "code": string,
      "message": string
    },
    "timing": {
      "total": double
    },
    "i18n": {
      "rendererFormattedStrings": {
        "varianceDisclaimer": string,
        "opportunityResourceColumnLabel": string,
        "opportunitySavingsColumnLabel": string,
        "errorMissingAuditInfo": string,
        "errorLabel": string,
        "warningHeader": string,
        "auditGroupExpandTooltip": string,
        "passedAuditsGroupTitle": string,
        "notApplicableAuditsGroupTitle": string,
        "manualAuditsGroupTitle": string,
        "toplevelWarningsMessage": string,
        "scorescaleLabel": string,
        "crcLongestDurationLabel": string,
        "crcInitialNavigation": string,
        "lsPerformanceCategoryDescription": string,
        "labDataTitle": string
      }
    }
  },
  "analysisUTCTimestamp": string,
  "version": {
    "major": integer,
    "minor": integer
  }
}
Property name Value Description Notes
captchaResult string The captcha verify result

Acceptable values are:
  • "CAPTCHA_BLOCKING"
  • "CAPTCHA_MATCHED"
  • "CAPTCHA_NEEDED"
  • "CAPTCHA_NOT_NEEDED"
  • "CAPTCHA_UNMATCHED"
kind string Kind of result.
id string Canonicalized and final URL for the document, after following page redirects (if any).
loadingExperience nested object Metrics of end users' page loading experience.
loadingExperience.id string The url, pattern or origin which the metrics are on.
loadingExperience.metrics object
loadingExperience.metrics.(key) object The type of the metric.
loadingExperience.metrics.(key).distributions[] list
loadingExperience.metrics.(key).distributions[].min integer
loadingExperience.metrics.(key).distributions[].max integer
loadingExperience.metrics.(key).distributions[].proportion double
version object The version of PageSpeed used to generate these results.
version.major integer The major version number of PageSpeed used to generate these results.
version.minor integer The minor version number of PageSpeed used to generate these results.
loadingExperience.metrics.(key).category string

Acceptable values are:
  • "AVERAGE"
  • "FAST"
  • "NONE"
  • "SLOW"
loadingExperience.overall_category string

Acceptable values are:
  • "AVERAGE"
  • "FAST"
  • "NONE"
  • "SLOW"
loadingExperience.initial_url string
loadingExperience.metrics.(key).percentile integer
originLoadingExperience nested object Metrics of the aggregated page loading experience of the origin
originLoadingExperience.id string The url, pattern or origin which the metrics are on.
originLoadingExperience.metrics object
originLoadingExperience.metrics.(key) object The type of the metric.
originLoadingExperience.metrics.(key).percentile integer
originLoadingExperience.metrics.(key).distributions[] list
originLoadingExperience.metrics.(key).distributions[].min integer
originLoadingExperience.metrics.(key).distributions[].max integer
originLoadingExperience.metrics.(key).distributions[].proportion double
originLoadingExperience.metrics.(key).category string

Acceptable values are:
  • "AVERAGE"
  • "FAST"
  • "NONE"
  • "SLOW"
originLoadingExperience.overall_category string

Acceptable values are:
  • "AVERAGE"
  • "FAST"
  • "NONE"
  • "SLOW"
originLoadingExperience.initial_url string
analysisUTCTimestamp string The UTC timestamp of this analysis.
lighthouseResult nested object Lighthouse response for the audit url as an object.
lighthouseResult.requestedUrl string The original requested url.
lighthouseResult.finalUrl string The final resolved url that was audited.
lighthouseResult.lighthouseVersion string The lighthouse version that was used to generate this LHR.
lighthouseResult.userAgent string The user agent that was used to run this LHR.
lighthouseResult.fetchTime string The time that this run was fetched.
lighthouseResult.environment object Environment settings that were used when making this LHR.
lighthouseResult.environment.networkUserAgent string
lighthouseResult.environment.hostUserAgent string
lighthouseResult.environment.benchmarkIndex double
lighthouseResult.runWarnings[] list List of all run warnings in the LHR. Will always output to at least `[]`.
lighthouseResult.configSettings object The configuration settings for this LHR.
lighthouseResult.configSettings.emulatedFormFactor string The form factor the emulation should use

Acceptable values are:
  • "UNKNOWN_FORM_FACTOR"
  • "desktop"
  • "mobile"
  • "none"
lighthouseResult.configSettings.locale string The locale setting
lighthouseResult.configSettings.onlyCategories nested object
lighthouseResult.audits object Map of audits in the LHR.
lighthouseResult.audits.(key) nested object
lighthouseResult.audits.(key).id string The audit's id.
lighthouseResult.audits.(key).title string The human readable title.
lighthouseResult.audits.(key).description string The description of the audit.
lighthouseResult.audits.(key).score nested object
lighthouseResult.audits.(key).scoreDisplayMode string The enumerated score display mode.

Acceptable values are:
  • "SCORE_DISPLAY_MODE_UNSPECIFIED"
  • "binary"
  • "error"
  • "informative"
  • "manual"
  • "not_applicable"
  • "numeric"
lighthouseResult.audits.(key).displayValue string The value that should be displayed on the UI for this audit.
lighthouseResult.audits.(key).explanation string An explanation of the errors in the audit.
lighthouseResult.audits.(key).errorMessage string An error message from a thrown error inside the audit.
lighthouseResult.audits.(key).warnings nested object
lighthouseResult.audits.(key).details object Freeform details section of the audit.
lighthouseResult.audits.(key).details.(key) any value
lighthouseResult.categories object Map of categories in the LHR.
lighthouseResult.categories.(key) nested object
lighthouseResult.categories.(key).id string The string identifier of the category.
lighthouseResult.categories.(key).title string The human-friendly name of the category
lighthouseResult.categories.(key).description string A more detailed description of the category and its importance.
lighthouseResult.categories.(key).score nested object
lighthouseResult.categories.(key).manualDescription string A description for the manual audits in the category.
lighthouseResult.categories.(key).auditRefs[] list An array of references to all the audit members of this category.
lighthouseResult.categories.(key).auditRefs[].id string The audit ref id.
lighthouseResult.categories.(key).auditRefs[].weight double The weight this audit's score has on the overall category score.
lighthouseResult.categories.(key).auditRefs[].group string The category group that the audit belongs to (optional).
lighthouseResult.categoryGroups object Map of category groups in the LHR.
lighthouseResult.categoryGroups.(key) object
lighthouseResult.categoryGroups.(key).title string
lighthouseResult.categoryGroups.(key).description string
lighthouseResult.runtimeError object Object containing the code + message of any thrown runtime errors.
lighthouseResult.runtimeError.code string

Acceptable values are:
  • "ERRORED_DOCUMENT_REQUEST"
  • "FAILED_DOCUMENT_REQUEST"
  • "INSECURE_DOCUMENT_REQUEST"
  • "INVALID_SPEEDLINE"
  • "NO_DCL"
  • "NO_DOCUMENT_REQUEST"
  • "NO_ERROR"
  • "NO_FCP"
  • "NO_NAVSTART"
  • "NO_SCREENSHOTS"
  • "NO_SPEEDLINE_FRAMES"
  • "NO_TRACING_STARTED"
  • "PARSING_PROBLEM"
  • "PROTOCOL_TIMEOUT"
  • "READ_FAILED"
  • "SPEEDINDEX_OF_ZERO"
  • "TRACING_ALREADY_STARTED"
  • "UNKNOWN_ERROR"
lighthouseResult.runtimeError.message string
lighthouseResult.timing object Timing information for this LHR.
lighthouseResult.timing.total double The total duration of Lighthouse's run
lighthouseResult.i18n object The internationalization strings that are required to render the LHR.
lighthouseResult.i18n.rendererFormattedStrings object
lighthouseResult.i18n.rendererFormattedStrings.varianceDisclaimer string
lighthouseResult.i18n.rendererFormattedStrings.opportunityResourceColumnLabel string
lighthouseResult.i18n.rendererFormattedStrings.opportunitySavingsColumnLabel string
lighthouseResult.i18n.rendererFormattedStrings.errorMissingAuditInfo string
lighthouseResult.i18n.rendererFormattedStrings.errorLabel string
lighthouseResult.i18n.rendererFormattedStrings.warningHeader string
lighthouseResult.i18n.rendererFormattedStrings.auditGroupExpandTooltip string
lighthouseResult.i18n.rendererFormattedStrings.passedAuditsGroupTitle string
lighthouseResult.i18n.rendererFormattedStrings.notApplicableAuditsGroupTitle string
lighthouseResult.i18n.rendererFormattedStrings.manualAuditsGroupTitle string
lighthouseResult.i18n.rendererFormattedStrings.toplevelWarningsMessage string
lighthouseResult.i18n.rendererFormattedStrings.scorescaleLabel string
lighthouseResult.i18n.rendererFormattedStrings.crcLongestDurationLabel string
lighthouseResult.i18n.rendererFormattedStrings.crcInitialNavigation string
lighthouseResult.i18n.rendererFormattedStrings.lsPerformanceCategoryDescription string
lighthouseResult.i18n.rendererFormattedStrings.labDataTitle string

Try it!

Use the APIs Explorer below to call this method on live data and see the response.