# PageSpeed Monitor: Why Did My Page Get Slower? (`ademkacar/pagespeed-core-web-vitals-monitor`) Actor

Audits whole websites from the sitemap with Lighthouse (mobile + desktop), remembers every page and reports confirmed slowdowns with the cause: new third-party scripts, heavier JavaScript, bigger files. Optional own PageSpeed API key for real-user data.

- **URL**: https://apify.com/ademkacar/pagespeed-core-web-vitals-monitor.md
- **Developed by:** [Adem Kacar](https://apify.com/ademkacar) (community)
- **Categories:** SEO tools, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $20.00 / 1,000 page audited (own chrome)s

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

## PageSpeed Monitor: Why Did My Page Get Slower?

Audit a **whole website from its sitemap** with Lighthouse (mobile and desktop), **remember every page**, and get told **which pages got slower – and why**: a new third-party script, heavier JavaScript, a bigger image, a slower server.

Run it on a schedule (e.g. weekly) and you will hear about a slowdown before your client or Google does.

🇩🇪 [Deutsche Beschreibung weiter unten](#deutsch)

### What it does

- **Finds the pages for you**: enter just the website and the Actor finds the sitemap through `robots.txt` or `/sitemap.xml`. Sitemap indexes and `.xml.gz` are supported. You can also list single pages, include or skip paths (`/blog/**`, `/cart/**`), and take a **sample per page type** (e.g. 20 of `/products`, 20 of `/blog`), so a shop with 5,000 products does not cost 5,000 audits.
- **Audits each page** with Lighthouse 13 using the same settings as PageSpeed Insights. You get all 4 scores, LCP, CLS, TBT, FCP, Speed Index and TTFB with good / needs-improvement / poor ratings, plus page weight by file type, number of requests, the third-party share and the **top 3 fixes** with estimated savings.
- **Remembers each page** and compares it with the median of its last 5 audits. Lighthouse scores wobble by 10+ points between runs, so a suspected slowdown is **audited a second time** right away and only reported when it is confirmed. The second audit costs you nothing.
- **Explains the slowdown**, e.g. *"New third party: connect.chat-widget.example (+310 KB); JavaScript total +380 KB; 14 more requests"*. Improvements are reported too, so you can show the effect of your work.
- **Summary per page type** (`/products`, `/blog` …) and device, with the 5 slowest pages.
- **Optional Slack / Microsoft Teams message** when a slowdown is confirmed.
- **Optional own PageSpeed Insights API key**: about 6× cheaper, and you also get **real-user Core Web Vitals** (Chrome UX Report) for the page or the whole domain.
- Causes and summary in **English or German**.

### Who it is for

- **Web agencies and freelancers** who look after several client websites (WordPress, WooCommerce, Shopify …) and want to know every week which client page got slower and why.
- **Shop and website owners** who want to see the effect of every update, plugin or new marketing script.
- **SEO consultants** who need Core Web Vitals for a whole website, not for one page at a time.

### Quick start

1. Enter your website in **Website or sitemap**, e.g. `www.example.com`.
2. Choose a **Monitor name** per website or client, e.g. `client-acme`. Every run with the same name is compared with the earlier runs.
3. Start the Actor. The first run saves the baseline.
4. Create a **schedule** (Actor → Schedules, e.g. every Monday 6:00) with the same input. From the second run on you get slowdowns and improvements.

```json
{
    "sitemapUrl": "https://www.example-shop.com",
    "maxPages": 100,
    "maxPagesPerGroup": 20,
    "excludePatterns": ["/account/**", "/cart/**"],
    "devices": "both",
    "monitorName": "client-example-shop",
    "webhookUrl": "https://hooks.slack.com/services/…"
}
```

### Two ways to audit

|                       | Own Chrome (default)                | Your PageSpeed Insights API key                   |
| --------------------- | ----------------------------------- | ------------------------------------------------- |
| Setup                 | nothing                             | free key from Google (see below)                  |
| Price per audit       | $0.025                              | $0.004                                            |
| Speed                 | one page after the other, ~10–30 s  | 4 pages at once on Google's servers               |
| Real-user data (CrUX) | –                                   | ✓ (when Google has enough data)                   |
| Lab scores            | Lighthouse 13 in the Actor's Chrome | Lighthouse on Google's servers (like the website) |

Scores of the two ways are not mixed: each page is only compared with audits of the same way.

The Actor's own Chrome needs **4 GB memory** (the default). With less memory Lighthouse gets less CPU and the scores fall by 20–30 points, so the Actor warns you.

#### How to get a free PageSpeed Insights API key

1. Open the [Google Cloud Console](https://console.cloud.google.com/) and create a project (free, no billing needed).
2. Enable the **PageSpeed Insights API** (APIs & Services → Library).
3. Create an **API key** (APIs & Services → Credentials) and paste it into **Your PageSpeed Insights API key**.

Google allows about 25,000 requests per day per project (check your own quota in the console). The key is only sent to Google and is never stored or logged by the Actor.

### Output

#### Dataset – one flat row per page and device

Ready for Excel or Google Sheets. Views in the Console: **Overview**, **Changes & causes**, **Top fixes**, **Real-user data**.

```json
{
    "url": "https://www.example-shop.com/products/running-shoes",
    "group": "/products",
    "device": "mobile",
    "engine": "lighthouse",
    "status": "ok",
    "performanceScore": 58,
    "accessibilityScore": 91,
    "bestPracticesScore": 96,
    "seoScore": 100,
    "lcpMs": 4120,
    "lcpRating": "poor",
    "cls": 0.04,
    "clsRating": "good",
    "tbtMs": 640,
    "tbtRating": "poor",
    "totalKb": 2870,
    "scriptKb": 1240,
    "imageKb": 1110,
    "requestCount": 96,
    "thirdPartyKb": 520,
    "thirdPartyDomains": 9,
    "fix1": "Reduce unused JavaScript",
    "fix1SavingsMs": 1350,
    "changeType": "regressed",
    "confirmed": true,
    "baselinePerformanceScore": 81,
    "performanceDelta": -23,
    "lcpDeltaMs": 1480,
    "scriptKbDelta": 380,
    "causes": "New third party: connect.chat-widget.example (+310 KB); JavaScript total +380 KB; 14 more requests",
    "charged": true
}
```

(Example values. All fields are listed below.)

| Field                                                                                                                   | Meaning                                                                                                          |
| ----------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `url`, `finalUrl`                                                                                                       | audited page and the address after redirects                                                                     |
| `group`                                                                                                                 | page type = first path segment (`/products`), home page `/`                                                      |
| `device`, `engine`                                                                                                      | `mobile`/`desktop`, `lighthouse`/`psi`                                                                           |
| `status`, `note`                                                                                                        | `ok` or why the page was not audited (see below); not audited = not charged                                      |
| `auditedAt`                                                                                                             | time of the audit                                                                                                |
| `performanceScore`, `accessibilityScore`, `bestPracticesScore`, `seoScore`                                              | Lighthouse scores 0–100                                                                                          |
| `lcpMs`, `cls`, `tbtMs` + `…Rating`                                                                                     | lab Core Web Vitals with `good` / `needs-improvement` / `poor`                                                   |
| `fcpMs`, `speedIndexMs`, `ttfbMs`                                                                                       | more timings (TTFB = server response time)                                                                       |
| `fieldLcpMs`, `fieldInpMs`, `fieldCls`, `fieldCwvPassed`, `fieldScope`                                                  | real-user data (75th percentile) – only with your API key; `fieldScope` = `url` or `origin` (whole domain)       |
| `totalKb`, `scriptKb`, `imageKb`, `requestCount`                                                                        | page weight and number of requests                                                                               |
| `thirdPartyKb`, `thirdPartyDomains`                                                                                     | size and number of third parties                                                                                 |
| `fix1` … `fix3`, `fix1SavingsMs` …                                                                                      | the 3 Lighthouse suggestions with the biggest estimated saving                                                   |
| `changeType`                                                                                                            | `baseline` (first audit), `unchanged`, `regressed`, `improved`, `unconfirmed` (suspicion not confirmed), `error` |
| `confirmed`                                                                                                             | slowdown confirmed by the second audit                                                                           |
| `baselinePerformanceScore`, `performanceDelta`, `lcpDeltaMs`, `tbtDeltaMs`, `clsDelta`, `totalKbDelta`, `scriptKbDelta` | comparison with the median of the earlier audits                                                                 |
| `causes`                                                                                                                | why the page got slower (or faster)                                                                              |
| `monitorName`, `charged`                                                                                                | history name, and whether this row was charged                                                                   |

`status` values: `ok`, `invalid-url`, `blocked-by-robots`, `unreachable`, `not-html`, `http-error`, `timeout`, `audit-failed`, `quota-exceeded`, `charge-limit-reached`. **Only `ok` rows are charged.**

#### Summary (key-value store record `SUMMARY`)

```json
{
    "monitorName": "client-example-shop",
    "pagesAudited": 140,
    "regressed": 3,
    "improved": 1,
    "groups": [
        {
            "group": "/products",
            "device": "mobile",
            "pages": 20,
            "medianPerformance": 61,
            "cwvPassRate": null,
            "regressed": 2
        },
        {
            "group": "/blog",
            "device": "mobile",
            "pages": 20,
            "medianPerformance": 84,
            "cwvPassRate": null,
            "regressed": 0
        }
    ],
    "slowest": [
        { "url": "https://www.example-shop.com/products/running-shoes", "device": "mobile", "performanceScore": 58 }
    ],
    "text": "3 pages got slower, 1 faster (140 audits). Most affected: /products (mobile)."
}
```

#### History

Saved in the named key-value store `pagespeed-monitor-<monitor name>` in your own Apify account: only numbers, file types, third-party names and file paths without query strings – no page content. Use **Forget the history of this monitor** to start again.

### When is a page "slower"?

Compared with the median of the page's last 5 audits, at least one of:

- performance score drops by at least the threshold (default 10 points) **and** by more than the page usually wobbles,
- LCP rises by more than 20 % and 300 ms,
- CLS rises by more than 0.05,
- TBT rises by more than 50 % and 200 ms.

Then the page is audited again. Only if the second audit shows the same, the row says `regressed` and `confirmed: true`. Otherwise it says `unconfirmed`. Improvements use the same rules the other way round.

### Pricing

Pay per event – you only pay for successful audits (one page × one device):

| Event                                 | Price  |
| ------------------------------------- | ------ |
| Page audited (own Chrome)             | $0.025 |
| Page audited (your PageSpeed API key) | $0.004 |

Free: pages that could not be audited (errors, 404, not HTML, blocked by robots.txt) and the confirmation audit. The Actor respects your **maximum cost per run** and stops cleanly when it is reached.

Examples:

- 50 pages, mobile, own Chrome: 50 × $0.025 = **$1.25**
- 100 pages, mobile + desktop, own Chrome, weekly: 200 × $0.025 × ~4.3 = **about $21.50 per month**
- the same with your own API key: 200 × $0.004 × ~4.3 = **about $3.45 per month**

### Slack and Microsoft Teams

Create an *Incoming Webhook* in Slack or Teams and paste its address into **Webhook for slowdowns**. The message is only sent when a slowdown is confirmed. The JSON has a `text` field (works directly in Slack and Teams), plus `monitorName`, `runUrl` and the list of `regressions`. For e-mail, use Apify's built-in integrations (Actor → Integrations).

### Good to know

- **Only audit your own websites** or websites you have permission for. The Actor loads each page once or twice per run, like a normal visit, follows `robots.txt` (`User-agent: *`) and does not bypass bot protection or log in.
- Pages behind a login, cookie banners and link crawling are not supported in this version – use the sitemap or a list.
- No personal data is collected: no screenshots, no page text, no full Lighthouse report. Query strings are removed from file addresses.
- Scores from your own Chrome and from PageSpeed Insights differ a little, because the hardware differs. That is why the history is kept separately per engine.

### License and trademarks

This Actor uses [Lighthouse](https://github.com/GoogleChrome/lighthouse) (Apache License 2.0). Google, PageSpeed Insights, Lighthouse and Core Web Vitals are trademarks of Google LLC. This Actor is not made or endorsed by Google.

***

<a id="deutsch"></a>

### Deutsch

**PageSpeed-Monitor: Warum ist meine Seite langsamer geworden?** prüft eine **ganze Website über die Sitemap** mit Lighthouse (Handy und Desktop), merkt sich jede Seite und meldet, **welche Seiten langsamer wurden und warum**, zum Beispiel ein neues Drittanbieter-Skript, mehr JavaScript, ein größeres Bild oder ein langsamerer Server.

**So geht's**

1. Bei **Website or sitemap** die Website eintragen (z. B. `www.beispiel-shop.at`). Die Sitemap findet der Actor selbst.
2. Einen **Monitor name** je Website oder Kunde wählen, z. B. `kunde-beispiel`.
3. **Language of causes and summary** auf **Deutsch** stellen. Dann sind Ursachen, Zusammenfassung und Slack-Nachricht auf Deutsch, z. B. *„Neuer Drittanbieter: connect.chat-widget.example (+310 KB); JavaScript gesamt +380 KB; 14 Anfragen mehr“*.
4. Starten (der erste Lauf speichert die Ausgangswerte) und einen **Zeitplan** anlegen, z. B. jeden Montag um 6 Uhr.

**Gut zu wissen**

- Lighthouse-Werte schwanken von Lauf zu Lauf um 10 Punkte und mehr. Deshalb wird jede verdächtige Seite sofort ein zweites Mal geprüft und nur eine **bestätigte** Verschlechterung gemeldet. Die zweite Prüfung ist kostenlos.
- Mit einer **Stichprobe je Seitentyp** (`maxPagesPerGroup`) kostet ein Shop mit 5.000 Produkten nicht 5.000 Prüfungen.
- Mit einem **eigenen kostenlosen PageSpeed-Insights-Schlüssel** (Anleitung oben) kostet eine Prüfung 0,004 $ statt 0,025 $, und es gibt zusätzlich **echte Nutzerdaten** (CrUX).
- Bezahlt wird nur für erfolgreich geprüfte Seiten. Fehler, 404, PDFs und durch robots.txt gesperrte Seiten sind kostenlos.
- Bitte nur **eigene Websites** oder Websites mit Erlaubnis des Betreibers prüfen. Der Actor sammelt keine personenbezogenen Daten (keine Screenshots, keine Seitentexte, Query-Strings werden entfernt).
- Slack- oder Teams-Nachricht: Eingehenden Webhook anlegen und bei **Webhook for slowdowns** eintragen. Die Nachricht kommt nur bei bestätigten Verschlechterungen.

# Actor input Schema

## `sitemapUrl` (type: `string`):

A sitemap URL (e.g. https://www.example.com/sitemap.xml) or just the website (e.g. www.example.com). For a website the sitemap is found through robots.txt and /sitemap.xml. Sitemap indexes and .xml.gz files are supported.

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

Pages to audit, one per line. https:// is added when missing, duplicates are audited once. Can be combined with the sitemap.

## `maxPages` (type: `integer`):

Stop after this many pages (each page is audited once per device).

## `includePatterns` (type: `array`):

Optional path patterns for sitemap pages, e.g. /blog/\*\* or /products/\*. Empty = all pages.

## `excludePatterns` (type: `array`):

Optional path patterns to skip, e.g. /cart/\*\* or /account/\*\*.

## `maxPagesPerGroup` (type: `integer`):

Pages are grouped by the first path segment (/products, /blog …). Audit at most this many pages per group, so a shop with 5,000 product pages does not cost 5,000 audits. 0 = no limit.

## `devices` (type: `string`):

Mobile is what Google uses for ranking. Both = two audits per page.

## `pageSpeedApiKey` (type: `string`):

With your own free Google key the audits run on Google's servers: much cheaper, and you also get real-user Core Web Vitals (CrUX). The key is only sent to Google and never stored or logged. Without a key, Lighthouse runs in this Actor's own Chrome.

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

Auto = PageSpeed Insights API when you give a key, otherwise Lighthouse in this Actor's own Chrome.

## `monitorName` (type: `string`):

Name of the history this run is compared with. Use one name per website or client (e.g. client-acme), so separate schedules do not mix. Letters, digits and dashes, up to 40 characters.

## `performanceThreshold` (type: `integer`):

A page counts as slower when its performance score drops at least this much and more than it usually wobbles. LCP, CLS and TBT have their own fixed rules.

## `confirmRegressions` (type: `boolean`):

Lighthouse scores wobble between runs. A suspected slowdown is audited again right away and only reported when confirmed. The second audit is free for you.

## `onlyChanges` (type: `boolean`):

Every page is still audited (and charged); unchanged pages are left out of the dataset. The summary always covers all pages.

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

Called only when a slowdown is confirmed. The JSON has a text field, so Slack and Microsoft Teams incoming webhooks work directly.

## `language` (type: `string`):

English or German texts for the causes and the summary. Field names stay English.

## `resetHistory` (type: `boolean`):

Start from scratch: this run becomes the new baseline.

## Actor input object example

```json
{
  "urls": [
    "https://crawlee.dev"
  ],
  "maxPages": 50,
  "includePatterns": [],
  "excludePatterns": [],
  "maxPagesPerGroup": 0,
  "devices": "mobile",
  "engine": "auto",
  "monitorName": "default",
  "performanceThreshold": 10,
  "confirmRegressions": true,
  "onlyChanges": false,
  "language": "en",
  "resetHistory": false
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

## `changes` (type: `string`):

No description

## `fixes` (type: `string`):

No description

## `field` (type: `string`):

No description

## `summary` (type: `string`):

No description

# 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://crawlee.dev"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("ademkacar/pagespeed-core-web-vitals-monitor").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://crawlee.dev"] }

# Run the Actor and wait for it to finish
run = client.actor("ademkacar/pagespeed-core-web-vitals-monitor").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://crawlee.dev"
  ]
}' |
apify call ademkacar/pagespeed-core-web-vitals-monitor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,ademkacar/pagespeed-core-web-vitals-monitor"
        }
    }
}
```

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/VnQwTIcceHi8IncdP/builds/xdkzXCe9LBz2ZHyVK/openapi.json
