lighthouse

Basic Custom Audit Recipe

Tip: see Lighthouse Architecture for information on terminology and architecture.

What this example does

This example shows how to write a custom Lighthouse audit for a hypothetical search page. The page is considered fully initialized when the main search box (the page’s “hero element”) is ready to be used. When this happens, the page uses performance.now() to find the time since navigation start and saves the value in a global variable called window.myLoadMetrics.searchableTime.

The Audit, Gatherer, and Config

Note: when extending the default configuration file, passes with the same name are merged together, all other arrays will be concatenated, and primitive values will override the defaults.

Run the configuration

Run Lighthouse with the custom audit by using the --config-path flag with your configuration file:

lighthouse --config-path=custom-config.js https://example.com