# Website Speed Watch – Lighthouse Regression Alerts (`datvanu/website-speed-watch`) Actor

Monitor Core Web Vitals with Lighthouse (median of several runs). Get alerts only when performance gets worse vs. last run or a rolling baseline – no noise, no charge for failed pages.

- **URL**: https://apify.com/datvanu/website-speed-watch.md
- **Developed by:** [Kilian Schieri](https://apify.com/datvanu) (community)
- **Categories:** SEO tools, Developer tools, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## 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

## Website Speed Watch: Lighthouse regression alerts

**Monitor Core Web Vitals with real Lighthouse runs in headless Chrome. The actor takes the median of several runs and alerts you only when a page gets slower than its last run or its rolling baseline. Failed or unreachable pages are never reported as regressions and never charged.**

🇬🇧 [English](#english) · 🇩🇪 [Deutsch](#deutsch)

***

### English

#### Why?

Most Lighthouse actors return a full report on every run, so on a daily schedule you have to read 30 reports a month to notice the one that matters. Website Speed Watch keeps a **baseline per URL and device** and writes a row (and optionally a webhook or email payload) only when something changes.

- Lighthouse 13 in headless Chrome: **mobile** (Moto G, slow 4G, simulated) and/or **desktop**
- **Median of 1–7 runs** per URL and device to suppress lab noise
- Tracks Performance score, **LCP, CLS, TBT** (lab proxy for INP), FCP and Speed Index
- Compare against the **last run** or a **rolling baseline** (median of the last N runs)
- **Two-sided thresholds:** a change counts only if it exceeds both a relative and an absolute limit. Example: LCP has to be +20 % and +300 ms.
- **Confirmation:** by default a regression must show up in 2 consecutive scheduled runs before it alerts. This filters one-off blips such as a flaky cookie banner.
- **Dedupe:** each regression alerts once and stays open until it recovers, so you won't get the same alarm every day. Optionally the actor also reports improvements and recoveries.
- Ready-made `payload` (subject, text, html) for email or Slack, plus an optional **webhook** POST
- Timeouts, DNS errors, bot blocks (HTTP 429/403) and pages that fail to render produce an `ERROR` row. They are **not charged** and do not touch the baseline.
- No Google account or API key needed

#### Typical use

1. Add your key pages (home, product page, checkout) and pick `mobile` (plus `desktop` if you want).
2. Schedule it daily, or after each deployment via an Apify webhook or the API.
3. Connect alerts through `webhookUrl` (Slack, Make, n8n, Zapier) or Apify integrations on the dataset.

#### Input example

```json
{ "urls": ["https://example.com/", "https://example.com/pricing"], "devices": ["mobile", "desktop"],
  "runsPerUrl": 3, "baselineMode": "rolling", "baselineWindow": 5, "confirmRuns": 2,
  "thresholds": { "lcpMs": { "pct": 15, "abs": 250 } }, "reportImprovements": false,
  "webhookUrl": "https://hooks.example.com/speed" }
```

#### Default thresholds

| Metric | Relative | Absolute |
|---|---|---|
| Performance score | – | 5 points |
| LCP | 20 % | 300 ms |
| CLS | – | 0.05 |
| TBT | 30 % | 100 ms |
| FCP | 20 % | 200 ms |
| Speed Index | 25 % | 500 ms |

#### Output (one row per URL × device)

`status` is one of:

- `BASELINE_CREATED`: first run
- `OK`
- `UNCONFIRMED`: change seen once, waiting for confirmation
- `REGRESSION`: new alert
- `REGRESSION_OPEN`: already alerted, still slow
- `IMPROVEMENT`
- `ERROR`

Each row also has `metrics`, `baseline`, `changes`, `alerts`, `payload {subject,text,html}`, `runMetrics` (every single run) and `runsOk`. With `outputMode: "alertsOnly"` (default) the dataset only holds alerts, new baselines and errors. `RUN_SUMMARY` in the default key-value store sums up the run. Baselines live in the named store `stateStoreName`. Use one name per project.

#### How much does it cost? (pay per event)

| Event | Price |
|---|---|
| `audit` – per successfully audited URL × device (median of up to 3 runs; 4–6 runs = 2 audits, 7 runs = 3) | **USD 0.012** |
| `apify-actor-start` – per run (Apify default, charged per GB of memory, 2 GB default) | USD 0.00005 |

5 URLs on mobile, checked daily ≈ 150 audits ≈ **USD 1.80 per month**. Errors, timeouts and blocked pages are **free**. The current price is always shown on the Pricing tab.

#### FAQ

- **Why is the dataset empty?** With `outputMode: "alertsOnly"` (recommended for schedules) only alerts, new baselines and errors are written. The form starts with `all` so a test run always shows rows.
- **How do I get alerts?** Set `webhookUrl`, or connect the dataset to Slack / e-mail integrations. Each row has a ready `payload` (subject, text, html).
- **Field data (CrUX)?** No – these are lab measurements from Apify servers.

#### Limits

Lighthouse numbers are lab data from Apify's servers, not field data (CrUX). INP needs real users, so TBT is used as the lab proxy. Some sites block headless Chrome (for example HTTP 429). Those pages appear as `ERROR` and are not charged.

***

### Deutsch

#### Wozu?

Die meisten Lighthouse-Actors liefern bei jedem Lauf einen kompletten Bericht. Website Speed Watch merkt sich je URL und Gerät einen **Basiswert** und meldet sich nur, wenn eine Seite **langsamer** wird.

- Lighthouse 13 in Headless Chrome, **mobil** und/oder **Desktop**
- **Median aus 1–7 Läufen** gegen Messrauschen
- Performance-Score, **LCP, CLS, TBT** (Labor-Ersatz für INP), FCP, Speed Index
- Vergleich mit dem **letzten Lauf** oder einer **gleitenden Baseline** (Median der letzten N Läufe)
- **Doppelte Schwellen:** Eine Änderung zählt erst, wenn sie die relative **und** die absolute Grenze überschreitet.
- **Bestätigung:** Standardmäßig muss eine Verschlechterung in 2 geplanten Läufen hintereinander auftreten.
- **Dedupe:** Jede Verschlechterung wird einmal gemeldet und bleibt offen, bis sie behoben ist. Auf Wunsch meldet der Actor auch Verbesserungen.
- Fertiger `payload` für E-Mail oder Slack, optional **Webhook**
- Timeouts, nicht erreichbare oder blockierte Seiten ergeben `ERROR`. Sie werden **nicht berechnet** und ändern den Basiswert nicht.

#### Preis

Pay-per-Event: **0,012 USD** je **erfolgreich gemessener URL × Gerät** (5 URLs mobil täglich ≈ 1,80 USD/Monat). Fehler sind kostenlos. Für den Zeitplan `outputMode: alertsOnly` wählen.

#### Grenzen

Es handelt sich um Labordaten von Apify-Servern, nicht um Felddaten aus CrUX. INP lässt sich nur mit echten Nutzern messen, deshalb dient TBT als Ersatz.

# Actor input Schema

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

Pages to audit (max 200). https:// is added if missing.

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

Lighthouse form factor(s). Each URL × device is one audit.

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

Lighthouse runs per URL × device; the median is used to suppress lab noise.

## `baselineMode` (type: `string`):

Baseline used to detect regressions.

## `baselineWindow` (type: `integer`):

Number of previous runs in the rolling baseline.

## `thresholds` (type: `object`):

Override per metric. A change counts only if it exceeds BOTH pct and abs. Keys: performanceScore, lcpMs, cls, tbtMs, fcpMs, speedIndexMs.

## `confirmRuns` (type: `integer`):

Alert only when a regression is seen in N consecutive Actor runs (2 = filters one-off lab noise such as a flaky cookie banner; 1 = alert immediately).

## `reportImprovements` (type: `boolean`):

Report improvements and recoveries, not only regressions.

## `outputMode` (type: `string`):

What to write to the dataset.

## `webhookUrl` (type: `string`):

https URL that receives a JSON POST with all alerts of the run (Slack/Make/n8n/Zapier).

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

Pages that do not load in time are reported as ERROR – not as regression, not charged.

## `stateStoreName` (type: `string`):

Named key-value store with the baselines. Use a different name per monitored project.

## Actor input object example

```json
{
  "urls": [
    "https://example.com/"
  ],
  "devices": [
    "mobile"
  ],
  "runsPerUrl": 3,
  "baselineMode": "rolling",
  "baselineWindow": 5,
  "thresholds": {
    "performanceScore": {
      "abs": 5
    },
    "lcpMs": {
      "pct": 20,
      "abs": 300
    },
    "cls": {
      "abs": 0.05
    },
    "tbtMs": {
      "pct": 30,
      "abs": 100
    }
  },
  "confirmRuns": 2,
  "reportImprovements": false,
  "outputMode": "all",
  "timeoutSecs": 60,
  "stateStoreName": "website-speed-watch-state"
}
```

# Actor output Schema

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

All items of the default dataset (JSON). Add ?format=csv or xlsx for other formats.

## `runSummary` (type: `string`):

Counts, warnings and charged events of this run (key RUN_SUMMARY).

# 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/"
    ],
    "thresholds": {
        "performanceScore": {
            "abs": 5
        },
        "lcpMs": {
            "pct": 20,
            "abs": 300
        },
        "cls": {
            "abs": 0.05
        },
        "tbtMs": {
            "pct": 30,
            "abs": 100
        }
    },
    "outputMode": "all"
};

// Run the Actor and wait for it to finish
const run = await client.actor("datvanu/website-speed-watch").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/"],
    "thresholds": {
        "performanceScore": { "abs": 5 },
        "lcpMs": {
            "pct": 20,
            "abs": 300,
        },
        "cls": { "abs": 0.05 },
        "tbtMs": {
            "pct": 30,
            "abs": 100,
        },
    },
    "outputMode": "all",
}

# Run the Actor and wait for it to finish
run = client.actor("datvanu/website-speed-watch").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/"
  ],
  "thresholds": {
    "performanceScore": {
      "abs": 5
    },
    "lcpMs": {
      "pct": 20,
      "abs": 300
    },
    "cls": {
      "abs": 0.05
    },
    "tbtMs": {
      "pct": 30,
      "abs": 100
    }
  },
  "outputMode": "all"
}' |
apify call datvanu/website-speed-watch --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,datvanu/website-speed-watch"
        }
    }
}
```

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/pbJzBPRZKKXoSzaXQ/builds/VDOjwdXwe1LoeycRf/openapi.json
