Skip to content

lighthouse

A full Lighthouse report for any URL:
const report = await microlink.lighthouse('https://example.com')

console.log(report.categories.performance.score)
It resolves to the Lighthouse result object — categories, audits, timing, and the rest — serialized as JSON by default, which lighthouse.microlink.io can render as a shareable page.

Options

  • onlyCategories <string[]> — runs only the given categories, e.g. ['performance', 'accessibility'].
  • onlyAudits <string[]> — runs only the given audits.
  • skipAudits <string[]> — skips the given audits.
  • output <string> | <string[]> — the report format: 'json', 'html', or 'csv' (default: 'json').
Any shared option applies too. A report reflects the emulated device, and it's expensive enough to be worth a long ttl.

Examples

Audit just two categories and get the report as a self-contained HTML page:
const report = await microlink.lighthouse('https://example.com', {
  onlyCategories: ['performance', 'accessibility'],
  output: 'html'
})
The Core Web Vitals of a page on a phone, cached for a day:
const { audits } = await microlink.lighthouse('https://example.com', {
  device: 'iPhone 11',
  onlyAudits: ['largest-contentful-paint', 'cumulative-layout-shift', 'total-blocking-time'],
  ttl: '1d'
})

for (const { title, displayValue } of Object.values(audits)) console.log(title, displayValue)
Other Lighthouse settings, such as preset, aren't routed by the SDK yet; call the API directly with insights.lighthouse.preset when you need them, as shown on the lighthouse parameter page.
See the lighthouse parameter for the underlying API and Lighthouse reports in the insights guide.