# Lighthouse Median — Stable PageSpeed & Core Web Vitals Scores (`northbell/lighthouse-median`) Actor

Google Lighthouse run several times per page inside the Actor. Returns the median and range of each score and of Core Web Vitals (LCP, CLS, TBT), so you see real changes, not noise. No PageSpeed API key or quota.

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

## Pricing

from $40.00 / 1,000 audits

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 Median — Page Speed Scores You Can Trust

**One Lighthouse run can swing 10–16 points; this runs each page several times and gives you the median and the range, so you see real changes, not noise.**

**Try it now — the input is already filled in.** Press **Start**: the page is audited 3 times on a phone profile and you get one row with the median score, the lowest and the highest of each category and speed metric, a `stable` flag and the top 5 things to fix.

- Lighthouse runs inside this Actor. No PageSpeed Insights API key, no quota.
- Price: **$0.05 per audit** (one page on one device, with all its runs). Pages that are skipped or fail are free.
- Audit only sites you own or are allowed to test; pages blocked by robots.txt are skipped and free.

The row from our own run of exactly this input on Apify (21 Nov 2026, 28 seconds). A light page scores high; on a heavy page the range is wider and `stable` turns false:

```json
{
  "url": "https://example.com/",
  "device": "mobile",
  "status": "ok",
  "reason": null,
  "runs": 3,
  "performance": { "median": 100, "min": 96, "max": 100 },
  "accessibility": { "median": 100, "min": 100, "max": 100 },
  "bestPractices": { "median": 100, "min": 100, "max": 100 },
  "seo": { "median": 80, "min": 80, "max": 80 },
  "metrics": {
    "lcpMs": { "median": 931, "min": 922, "max": 971 },
    "fcpMs": { "median": 931, "min": 922, "max": 971 },
    "tbtMs": { "median": 8, "min": 0, "max": 216 },
    "cls": { "median": 0, "min": 0, "max": 0 },
    "speedIndexMs": { "median": 931, "min": 922, "max": 971 },
    "ttiMs": { "median": 1068, "min": 931, "max": 1238 }
  },
  "stable": true,
  "topOpportunities": [
    { "title": "Eliminate render-blocking resources", "savingsMs": 147, "savingsBytes": 0 }
  ],
  "lighthouseVersion": "12.8.2",
  "finalUrl": "https://example.com/",
  "auditedAt": "2026-11-21T08:57:13.805Z"
}
```

### What you get

Per page and device (mobile or desktop), one row:

- **Median, min and max** of the four category scores (performance, accessibility, best practices, SEO) and of six metrics: LCP, FCP, TBT, CLS, Speed Index, TTI.
- **`stable`**: true when the performance score moved by 5 points or less across the runs. If it is false, the median is still the best single number, but the page itself is jumpy (heavy scripts, slow server, ads); look at min and max.
- **`topOpportunities`**: up to 5 savings Lighthouse suggests (title, estimated milliseconds and bytes saved), taken from the run whose performance score is the median. With an even number of runs, the run closest to the median.
- `status`: `ok`, `skipped_robots` (free) or `failed` (free), with a `reason`.

A row where some runs failed but at least one worked is `ok`, with `runs` showing how many counted and `reason` saying so.

### Inputs

| Input | What it does |
|---|---|
| `urls` | Full page addresses (at most 200 per run). |
| `devices` | `["mobile"]` (default), `["desktop"]` or both. Both = 2 audits per URL. Mobile is Lighthouse's default: phone screen, simulated slow 4G, 4x slower CPU. Desktop is Lighthouse's desktop setting. |
| `runs` | 1 to 5 (default 3) Lighthouse runs per page and device, one after the other. |
| `categories` | `performance`, `accessibility`, `best-practices`, `seo`. Default: all four. Metrics and opportunities come with `performance`. |
| `onlyChangedSinceLastRun` | Off by default. On: pages are still audited, but a row is returned and charged only when its performance median moved by at least `minChange` since the last row returned for that page and device. The first audit of a page and device is returned as the starting point. Needs `performance`. |
| `minChange` | Points, default 5. Used with the option above. The row then has `previousPerformance`. |

### Run it on a schedule

Schedule the Actor daily or after each deploy with `onlyChangedSinceLastRun` on and a charge limit you are comfortable with. To set it up: save the URLs as a task with that option on and add a daily Schedule to that task in Apify Console. The last returned scores live in a named store of your own account (`lighthouse-median-last`). If that store cannot be opened, a run with the option on stops before charging anything.

```bash
curl -X POST "https://api.apify.com/v2/acts/northbell~lighthouse-median/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"urls":["https://example.com/"],"devices":["mobile","desktop"],"runs":3}'
```

### Pricing

Pay per event: **$0.05 per audit** (one URL on one device with all its runs). Each row is pushed first and then charged. Skipped (robots.txt) and failed pages are not charged. Set a maximum charge on the run and the Actor stops cleanly when it is reached; everything charged is in the dataset.

### How long it takes

Each run takes roughly 10 to 40 seconds, so 3 runs of one page is often 30 to 120 seconds, and a list of 20 pages on two devices can take over an hour. Pages heavy on JavaScript take longer. The Actor stops 30 seconds before the run's time limit and returns what is finished; raise the timeout in Run options for long lists.

### Limits

- **Lab data only.** These are simulated Lighthouse tests from one Apify server, not field data from real visitors (CrUX). Scores will differ from PageSpeed Insights and from your own laptop, because the machine and network are different. Compare runs of this Actor with each other.
- **Pages that need a login** are not supported. A login page that answers 200 is audited as the login page (check `finalUrl`).
- **robots.txt** is read once per host. If it disallows the path for Lighthouse or for all robots, the row is `skipped_robots`. If robots.txt answers a server error, the page is skipped too.
- **Failed pages**: a non-2xx answer, a page that does not load, or a timeout gives a `failed` row.
- **Not a replacement for load testing.** Runs go one after another from one machine.

### 日本語の説明

Google Lighthouse をこの Actor の中で複数回（既定3回）実行し、ページごと・端末（モバイル／デスクトップ）ごとに、各スコアと各指標（LCP・FCP・TBT・CLS・Speed Index・TTI）の中央値と最小・最大を返します。Lighthouse は1回ごとに10〜16点ほど揺れるため、中央値とばらつきを見ることで、ノイズではなく本当の変化が分かります。PageSpeed Insights の API キーや無料枠は不要です。自分のサイト、またはテストを許可されたサイトだけを対象にしてください。robots.txt で禁止されているページはスキップされ、課金されません（失敗したページも無料）。料金は1ページ1端末（全回数込み）で1回 $0.05。「前回から変化したものだけ」を使うと、パフォーマンスの中央値が一定以上動いた行だけが返され、課金されます。実測値（実ユーザーのデータ）ではなく、シミュレーションによる実験室データです。

# Actor input Schema

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

Full addresses of the pages to audit, for example https://example.com/. Audit only sites you own or are allowed to test. Pages blocked by robots.txt are skipped and free. At most 200.

## `devices` (type: `array`):

Each page is audited once per device you pick. Both devices = 2 audits per URL.

## `runs` (type: `integer`):

How many times Lighthouse runs on each page and device (1 to 5). The result is the median of these runs, plus the lowest and highest. 3 is a good start.

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

Which Lighthouse categories to score. Empty: all four. The speed metrics (LCP, FCP, TBT, CLS, Speed Index, TTI) come with Performance.

## `onlyChangedSinceLastRun` (type: `boolean`):

Off (default): every audit is returned and charged. On: every page is still audited, but only audits whose performance median moved by at least the value below since the last time they were returned are returned and charged. The first audit of a page and device is returned as the starting point. Needs Performance in the categories.

## `minChange` (type: `integer`):

Used with 'Only changed since last run': the performance median must differ from the last returned one by at least this many points.

## Actor input object example

```json
{
  "urls": [
    "https://example.com/"
  ],
  "devices": [
    "mobile"
  ],
  "runs": 3,
  "categories": [
    "performance",
    "accessibility",
    "best-practices",
    "seo"
  ],
  "onlyChangedSinceLastRun": false,
  "minChange": 5
}
```

# Actor output Schema

## `audits` (type: `string`):

Median and range of the scores and metrics, stable flag, top opportunities.

# 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/"
    ],
    "devices": [
        "mobile"
    ],
    "runs": 3
};

// Run the Actor and wait for it to finish
const run = await client.actor("northbell/lighthouse-median").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/"],
    "devices": ["mobile"],
    "runs": 3,
}

# Run the Actor and wait for it to finish
run = client.actor("northbell/lighthouse-median").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/"
  ],
  "devices": [
    "mobile"
  ],
  "runs": 3
}' |
apify call northbell/lighthouse-median --silent --output-dataset

```

## MCP server setup

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

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/E7Cls7cIIRhDCzXXf/builds/BZHdq5aHaQaLj45M8/openapi.json
