# Lighthouse & PageSpeed Batch Auditor (Core Web Vitals) (`oqen/lighthouse-batch-auditor`) Actor

Audit a list of URLs with Google Lighthouse (mobile + desktop): performance, accessibility, best-practices and SEO scores, LCP/TBT/CLS/FCP, ranked top issues with savings, full HTML reports, optional median-of-N runs or PageSpeed Insights API with CrUX field data.

- **URL**: https://apify.com/oqen/lighthouse-batch-auditor.md
- **Developed by:** [oqen](https://apify.com/oqen) (community)
- **Categories:** SEO tools, Developer tools, Marketing
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $6.00 / 1,000 lighthouse runs

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Lighthouse & PageSpeed Batch Auditor (Core Web Vitals)

Run **Google Lighthouse** on a whole list of pages and get one clean table: performance, accessibility, best-practices and SEO scores, Core Web Vitals lab metrics, and the **issues worth fixing first**. Every row links to the full Lighthouse HTML report.

Good for SEO audits of client sites, before/after checks around a release, monitoring a set of landing pages on a schedule, or comparing your pages with competitors.

### Why this one

- **No API key needed.** Lighthouse 12 runs inside the Actor's own headless Chrome, so you aren't blocked by the tiny shared PageSpeed Insights quota that keyless tools hit.
- **Stable numbers.** Lighthouse performance scores vary between runs. Set `runsPerUrl` to 3 and you get the **median** of each score and metric, the way Google recommends, plus `performanceRuns` so you can see the spread.
- **Actionable output.** `topIssues` ranks failing audits by estimated time savings, then by their weight in the score. You see "Reduce unused JavaScript: 1.2 s" first, not 40 green checks.
- **Real-user data when you want it.** Switch `engine` to `psi` with your free Google API key and each row also gets **CrUX field data** (p75 LCP, INP, CLS, FCP, TTFB) for the URL and the whole origin.
- Mobile and desktop in one run, using the same settings as PageSpeed Insights (mobile = emulated Moto G Power on slow 4G).

### Output example

```json
{ "url": "https://apify.com/", "strategy": "mobile", "engine": "local", "status": "ok",
  "performance": 40, "accessibility": 100, "bestPractices": 75, "seo": 85,
  "fcpMs": 2310, "lcpMs": 8734, "tbtMs": 2787, "cls": 0.001, "speedIndexMs": 6120, "ttfbMs": 210,
  "topIssues": [ { "id": "unused-javascript", "title": "Reduce unused JavaScript", "savingsMs": 1200, "savingsBytes": 412000, "score": 0 } ],
  "reportUrl": "https://api.apify.com/v2/key-value-stores/.../records/report-0003-mobile-apify.com.html" }
```

Unreachable pages, DNS errors, certificate interstitials and timeouts come back as `status: "error"` rows with Lighthouse's own error code. **They are not charged.**

### Notes on accuracy

Lab scores depend on the machine running the test. Local runs use Lighthouse's simulated throttling, like PageSpeed Insights, so scores are usually close but not identical to the PSI web page. For numbers that match PSI exactly, use `engine: "psi"`, which runs on Google's servers.

### Pricing

Pay per event: one `lighthouse-run` per successful Lighthouse run (one URL × one device × one run). Failed audits are free. With `runsPerUrl: 3`, a URL costs 3 runs. A single audit takes about 10–30 s, and the Actor runs audits one at a time so CPU contention doesn't distort scores. Use `maxUrls` and *Max cost per run* to cap spend.

# Actor input Schema

## `urls` (type: `array`):

Pages to audit. 'https://' is added if missing. Duplicates are removed.

## `urlsText` (type: `string`):

Whitespace- or newline-separated list of URLs.

## `strategies` (type: `array`):

Each device is a separate audit (and event).

## `categories` (type: `array`):

Lighthouse categories to run. Fewer categories run faster.

## `engine` (type: `string`):

Local Lighthouse runs in this Actor's headless Chrome. The PSI API runs on Google's servers and also returns Chrome UX Report field data.

## `psiApiKey` (type: `string`):

Only for engine = psi. Free from Google Cloud Console (PageSpeed Insights API, 25,000 requests/day). Keyless requests share a tiny global quota and usually fail.

## `runsPerUrl` (type: `integer`):

Local engine only. Lighthouse performance scores vary run to run; 3 runs with the median is what Google recommends for stable numbers. Each run is billed as one event.

## `maxIssues` (type: `integer`):

Failing audits returned per page, ranked by estimated time savings and score weight.

## `saveHtmlReport` (type: `boolean`):

Local engine: stores the standard Lighthouse HTML report in the key-value store and links it as reportUrl.

## `timeoutSecs` (type: `integer`):

Audits that take longer fail (free).

## `maxUrls` (type: `integer`):

Safety cap.

## Actor input object example

```json
{
  "urls": [
    "https://example.com",
    "https://apify.com"
  ],
  "strategies": [
    "mobile"
  ],
  "categories": [
    "performance",
    "accessibility",
    "best-practices",
    "seo"
  ],
  "engine": "local",
  "runsPerUrl": 1,
  "maxIssues": 10,
  "saveHtmlReport": true,
  "timeoutSecs": 90,
  "maxUrls": 100
}
```

# Actor output Schema

## `results` (type: `string`):

One item per URL and device: category scores (0-100), lab metrics (ms), top issues with savings, CrUX field data (PSI engine), reportUrl; failed audits have status=error.

## `reports` (type: `string`):

Full Lighthouse HTML reports (local engine).

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "urls": [
        "https://example.com",
        "https://apify.com"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("oqen/lighthouse-batch-auditor").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "urls": [
        "https://example.com",
        "https://apify.com",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("oqen/lighthouse-batch-auditor").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "urls": [
    "https://example.com",
    "https://apify.com"
  ]
}' |
apify call oqen/lighthouse-batch-auditor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,oqen/lighthouse-batch-auditor"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/gQDPKTaTL7EYkQ8gu/builds/0f9hIVX5iOllgNoA1/openapi.json
