1<html><body> 2<style> 3 4body, h1, h2, h3, div, span, p, pre, a { 5 margin: 0; 6 padding: 0; 7 border: 0; 8 font-weight: inherit; 9 font-style: inherit; 10 font-size: 100%; 11 font-family: inherit; 12 vertical-align: baseline; 13} 14 15body { 16 font-size: 13px; 17 padding: 1em; 18} 19 20h1 { 21 font-size: 26px; 22 margin-bottom: 1em; 23} 24 25h2 { 26 font-size: 24px; 27 margin-bottom: 1em; 28} 29 30h3 { 31 font-size: 20px; 32 margin-bottom: 1em; 33 margin-top: 1em; 34} 35 36pre, code { 37 line-height: 1.5; 38 font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace; 39} 40 41pre { 42 margin-top: 0.5em; 43} 44 45h1, h2, h3, p { 46 font-family: Arial, sans serif; 47} 48 49h1, h2, h3 { 50 border-bottom: solid #CCC 1px; 51} 52 53.toc_element { 54 margin-top: 0.5em; 55} 56 57.firstline { 58 margin-left: 2 em; 59} 60 61.method { 62 margin-top: 1em; 63 border: solid 1px #CCC; 64 padding: 1em; 65 background: #EEE; 66} 67 68.details { 69 font-weight: bold; 70 font-size: 14px; 71} 72 73</style> 74 75<h1><a href="pagespeedonline_v5.html">PageSpeed Insights API</a> . <a href="pagespeedonline_v5.pagespeedapi.html">pagespeedapi</a></h1> 76<h2>Instance Methods</h2> 77<p class="toc_element"> 78 <code><a href="#runpagespeed">runpagespeed(url, category=None, utm_campaign=None, locale=None, utm_source=None, strategy=None)</a></code></p> 79<p class="firstline">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.</p> 80<h3>Method Details</h3> 81<div class="method"> 82 <code class="details" id="runpagespeed">runpagespeed(url, category=None, utm_campaign=None, locale=None, utm_source=None, strategy=None)</code> 83 <pre>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. 84 85Args: 86 url: string, The URL to fetch and analyze (required) 87 category: string, A Lighthouse category to run; if none are given, only Performance category will be run (repeated) 88 Allowed values 89 accessibility - 90 best-practices - 91 performance - 92 pwa - 93 seo - 94 utm_campaign: string, Campaign name for analytics. 95 locale: string, The locale used to localize formatted results 96 utm_source: string, Campaign source for analytics. 97 strategy: string, The analysis strategy (desktop or mobile) to use, and desktop is the default 98 Allowed values 99 desktop - Fetch and analyze the URL for desktop browsers 100 mobile - Fetch and analyze the URL for mobile devices 101 102Returns: 103 An object of the form: 104 105 { 106 "kind": "pagespeedonline#result", # Kind of result. 107 "captchaResult": "A String", # The captcha verify result 108 "originLoadingExperience": { # Metrics of the aggregated page loading experience of the origin 109 "metrics": { 110 "a_key": { # The type of the metric. 111 "category": "A String", 112 "percentile": 42, 113 "distributions": [ 114 { 115 "max": 42, 116 "proportion": 3.14, 117 "min": 42, 118 }, 119 ], 120 }, 121 }, 122 "id": "A String", # The url, pattern or origin which the metrics are on. 123 "overall_category": "A String", 124 "initial_url": "A String", 125 }, 126 "loadingExperience": { # Metrics of end users' page loading experience. 127 "metrics": { 128 "a_key": { # The type of the metric. 129 "category": "A String", 130 "percentile": 42, 131 "distributions": [ 132 { 133 "max": 42, 134 "proportion": 3.14, 135 "min": 42, 136 }, 137 ], 138 }, 139 }, 140 "id": "A String", # The url, pattern or origin which the metrics are on. 141 "overall_category": "A String", 142 "initial_url": "A String", 143 }, 144 "version": { # The version of PageSpeed used to generate these results. 145 "major": 42, # The major version number of PageSpeed used to generate these results. 146 "minor": 42, # The minor version number of PageSpeed used to generate these results. 147 }, 148 "analysisUTCTimestamp": "A String", # The UTC timestamp of this analysis. 149 "lighthouseResult": { # Lighthouse response for the audit url as an object. 150 "stackPacks": [ # The Stack Pack advice strings. 151 { 152 "id": "A String", # The stack pack id. 153 "title": "A String", # The stack pack title. 154 "descriptions": { # The stack pack advice strings. 155 "a_key": "A String", # The specific stack pack description. 156 }, 157 "iconDataURL": "A String", # The stack pack icon data uri. 158 }, 159 ], 160 "fetchTime": "A String", # The time that this run was fetched. 161 "categoryGroups": { # Map of category groups in the LHR. 162 "a_key": { # A grouping contained in a category that groups similar audits together. 163 "description": "A String", # An optional human readable description of the category group. 164 "title": "A String", # The title of the category group. 165 }, 166 }, 167 "configSettings": { # The configuration settings for this LHR. 168 "locale": "A String", # The locale setting. 169 "onlyCategories": "", 170 "emulatedFormFactor": "A String", # The form factor the emulation should use. 171 }, 172 "runWarnings": [ # List of all run warnings in the LHR. Will always output to at least `[]`. 173 "", 174 ], 175 "finalUrl": "A String", # The final resolved url that was audited. 176 "lighthouseVersion": "A String", # The lighthouse version that was used to generate this LHR. 177 "environment": { # Environment settings that were used when making this LHR. 178 "benchmarkIndex": 3.14, # The benchmark index number that indicates rough device class. 179 "networkUserAgent": "A String", # The user agent string that was sent over the network. 180 "hostUserAgent": "A String", # The user agent string of the version of Chrome used. 181 }, 182 "timing": { # Timing information for this LHR. 183 "total": 3.14, # The total duration of Lighthouse's run. 184 }, 185 "i18n": { # The internationalization strings that are required to render the LHR. 186 "rendererFormattedStrings": { # Internationalized strings that are formatted to the locale in configSettings. 187 "toplevelWarningsMessage": "A String", # The label shown preceding important warnings that may have invalidated an entire report. 188 "labDataTitle": "A String", # The title of the lab data performance category. 189 "passedAuditsGroupTitle": "A String", # The heading that is shown above a list of audits that are passing. 190 "auditGroupExpandTooltip": "A String", # The tooltip text on an expandable chevron icon. 191 "warningHeader": "A String", # The label shown above a bulleted list of warnings. 192 "notApplicableAuditsGroupTitle": "A String", # The heading shown above a list of audits that do not apply to a page. 193 "crcLongestDurationLabel": "A String", # The label for values shown in the summary of critical request chains. 194 "opportunitySavingsColumnLabel": "A String", # The heading for the estimated page load savings of opportunity audits. 195 "errorMissingAuditInfo": "A String", # The error string shown next to an erroring audit. 196 "varianceDisclaimer": "A String", # The disclaimer shown below a performance metric value. 197 "lsPerformanceCategoryDescription": "A String", # The disclaimer shown under performance explaning that the network can vary. 198 "manualAuditsGroupTitle": "A String", # The heading shown above a list of audits that were not computerd in the run. 199 "opportunityResourceColumnLabel": "A String", # The heading for the estimated page load savings opportunity of an audit. 200 "crcInitialNavigation": "A String", # The label for the initial request in a critical request chain. 201 "scorescaleLabel": "A String", # The label that explains the score gauges scale (0-49, 50-89, 90-100). 202 "errorLabel": "A String", # The label shown next to an audit or metric that has had an error. 203 }, 204 }, 205 "userAgent": "A String", # The user agent that was used to run this LHR. 206 "audits": { # Map of audits in the LHR. 207 "a_key": { # An audit that was performed in this run. Keyed by audit id. 208 "description": "A String", # The description of the audit. 209 "title": "A String", # The human readable title. 210 "explanation": "A String", # An explanation of the errors in the audit. 211 "errorMessage": "A String", # An error message from a thrown error inside the audit. 212 "score": "", 213 "details": { # Freeform details section of the audit. 214 "a_key": "", 215 }, 216 "warnings": "", 217 "scoreDisplayMode": "A String", # The enumerated score display mode. 218 "displayValue": "A String", # The value that should be displayed on the UI for this audit. 219 "id": "A String", # The audit's id. 220 }, 221 }, 222 "runtimeError": { # A top-level error message that, if present, indicates a serious enough problem that this Lighthouse result may need to be discarded. 223 "message": "A String", # A human readable message explaining the error code. 224 "code": "A String", # The enumerated Lighthouse Error code. 225 }, 226 "categories": { # Map of categories in the LHR. 227 "seo": { # The Search-Engine-Optimization (SEO) category, containing all seo related audits. 228 "description": "A String", # A more detailed description of the category and its importance. 229 "title": "A String", # The human-friendly name of the category. 230 "auditRefs": [ # An array of references to all the audit members of this category. 231 { 232 "group": "A String", # The category group that the audit belongs to (optional). 233 "id": "A String", # The audit ref id. 234 "weight": 3.14, # The weight this audit's score has on the overall category score. 235 }, 236 ], 237 "manualDescription": "A String", # A description for the manual audits in the category. 238 "score": "", 239 "id": "A String", # The string identifier of the category. 240 }, 241 "best-practices": { # The best practices category, containing all web best practice related audits. 242 "description": "A String", # A more detailed description of the category and its importance. 243 "title": "A String", # The human-friendly name of the category. 244 "auditRefs": [ # An array of references to all the audit members of this category. 245 { 246 "group": "A String", # The category group that the audit belongs to (optional). 247 "id": "A String", # The audit ref id. 248 "weight": 3.14, # The weight this audit's score has on the overall category score. 249 }, 250 ], 251 "manualDescription": "A String", # A description for the manual audits in the category. 252 "score": "", 253 "id": "A String", # The string identifier of the category. 254 }, 255 "pwa": { # The Progressive-Web-App (PWA) category, containing all pwa related audits. 256 "description": "A String", # A more detailed description of the category and its importance. 257 "title": "A String", # The human-friendly name of the category. 258 "auditRefs": [ # An array of references to all the audit members of this category. 259 { 260 "group": "A String", # The category group that the audit belongs to (optional). 261 "id": "A String", # The audit ref id. 262 "weight": 3.14, # The weight this audit's score has on the overall category score. 263 }, 264 ], 265 "manualDescription": "A String", # A description for the manual audits in the category. 266 "score": "", 267 "id": "A String", # The string identifier of the category. 268 }, 269 "accessibility": { # The accessibility category, containing all accessibility related audits. 270 "description": "A String", # A more detailed description of the category and its importance. 271 "title": "A String", # The human-friendly name of the category. 272 "auditRefs": [ # An array of references to all the audit members of this category. 273 { 274 "group": "A String", # The category group that the audit belongs to (optional). 275 "id": "A String", # The audit ref id. 276 "weight": 3.14, # The weight this audit's score has on the overall category score. 277 }, 278 ], 279 "manualDescription": "A String", # A description for the manual audits in the category. 280 "score": "", 281 "id": "A String", # The string identifier of the category. 282 }, 283 "performance": { # The performance category, containing all performance related audits. 284 "description": "A String", # A more detailed description of the category and its importance. 285 "title": "A String", # The human-friendly name of the category. 286 "auditRefs": [ # An array of references to all the audit members of this category. 287 { 288 "group": "A String", # The category group that the audit belongs to (optional). 289 "id": "A String", # The audit ref id. 290 "weight": 3.14, # The weight this audit's score has on the overall category score. 291 }, 292 ], 293 "manualDescription": "A String", # A description for the manual audits in the category. 294 "score": "", 295 "id": "A String", # The string identifier of the category. 296 }, 297 }, 298 "requestedUrl": "A String", # The original requested url. 299 }, 300 "id": "A String", # Canonicalized and final URL for the document, after following page redirects (if any). 301 }</pre> 302</div> 303 304</body></html>