# Bulk PageSpeed & Core Web Vitals Audit (`fjordlabs/pagespeed-audit`) Actor

Audit hundreds of URLs or a whole sitemap with Google PageSpeed Insights: Lighthouse scores, lab metrics, real-user Core Web Vitals (CrUX) and top fixes, on mobile and desktop. Failed audits are free.

- **URL**: https://apify.com/fjordlabs/pagespeed-audit.md
- **Developed by:** [Mivah](https://apify.com/fjordlabs) (community)
- **Categories:** SEO tools, Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.00 / 1,000 page audits

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

## Bulk PageSpeed & Core Web Vitals Audit

Run **Google PageSpeed Insights** on hundreds of pages at once: paste URLs, or give a **sitemap** and audit the whole site. Each audit returns:

- 🟢 **Lighthouse scores:** Performance, Accessibility, Best Practices, SEO (0–100).
- ⏱️ **Lab metrics:** LCP, CLS, TBT, FCP, Speed Index, TTI and server response time.
- 👥 **Real-user Core Web Vitals (CrUX field data)** for the page *and* the whole origin: LCP, INP, CLS, FCP and TTFB at the 75th percentile, plus Google's pass/fail assessment.
- 🛠️ **Top fixes:** the biggest improvement opportunities, with estimated time (ms) and size (KiB) savings.
- 📱 **Mobile and desktop** in one run.

### Why this one?

- **Whole sites from a sitemap.** Sitemap indexes are followed automatically and URLs de-duplicated.
- **Honest field data.** When Google has no real-user data for a specific page, PageSpeed silently shows *origin* data instead. This Actor keeps the two apart (`fieldDataPage` vs `fieldDataOrigin`), so you never mistake site-wide numbers for a page's own.
- **Parallel and resilient.** Concurrent audits, with automatic retries when Google is busy.
- **Failed audits are free.** Pages that can't be audited are returned with an `error` and aren't charged.
- **Monitoring-ready.** Set `alertBelowPerformanceScore` and schedule a weekly run. Pages under the threshold get `alert: true`, ready for a Slack or email integration.

### Input example

```json
{
  "sitemapUrls": ["https://www.example.com/sitemap.xml"],
  "urls": ["https://www.example.com/pricing"],
  "maxUrls": 200,
  "strategies": ["mobile", "desktop"],
  "alertBelowPerformanceScore": 50
}
```

### Output example (shortened)

```json
{
  "url": "https://www.example.com/pricing",
  "strategy": "mobile",
  "scores": {"performance": 62, "accessibility": 94, "best-practices": 100, "seo": 92},
  "lab": {"lcpMs": 3890, "cls": 0.012, "tbtMs": 410, "fcpMs": 1650, "speedIndexMs": 3020, "ttiMs": 5900, "ttfbMs": 220},
  "fieldDataPage": null,
  "fieldDataOrigin": {"overall": "AVERAGE", "lcpMs": 2600, "lcpMsCategory": "AVERAGE", "inpMs": 180, "inpMsCategory": "FAST", "cls": 0.03, "clsCategory": "FAST"},
  "coreWebVitalsPassed": false,
  "opportunities": [
    {"id": "render-blocking-resources", "title": "Eliminate render-blocking resources", "savingsMs": 1210, "savingsKiB": 0},
    {"id": "unused-javascript", "title": "Reduce unused JavaScript", "savingsMs": 450, "savingsKiB": 310}
  ],
  "alert": false,
  "lighthouseVersion": "12.8.0"
}
```

### Pricing

| Event | Price |
|---|---|
| Actor start | $0.00005 |
| Page audit (one URL × one device) | **$0.004** |
| Failed audit | **free** |

A 200-page site on mobile and desktop (400 audits) costs **$1.60**.

### Use cases

- **SEO agencies:** audit a client's whole site in minutes and export to Sheets or CSV.
- **Developers:** check performance regressions across all templates after a release.
- **Monitoring:** run on a weekly schedule and alert on drops.
- **Competitor benchmarking:** compare Core Web Vitals across competitors' homepages.
- **AI agents:** callable through the Apify MCP server.

Lab data comes from Google's Lighthouse run in Google's data centres; field data is Google's Chrome UX Report (last 28 days of real Chrome users). Low-traffic pages often have no field data.

# Actor input Schema

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

Pages to audit. Domains without https:// are fine.

## `sitemapUrls` (type: `array`):

Sitemap or sitemap-index URLs. All page URLs inside are audited, up to the max URLs limit.

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

Upper limit on pages audited in one run (after sitemap expansion and de-duplication).

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

Audit as mobile, desktop, or both. Each URL × device is one audit.

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

Which Lighthouse scores to compute.

## `maxOpportunities` (type: `integer`):

How many improvement suggestions (with estimated savings) to include per audit.

## `alertBelowPerformanceScore` (type: `integer`):

Optional. Sets alert = true on pages under this score. Handy for scheduled monitoring with a webhook or Slack integration.

## `locale` (type: `string`):

Language for audit titles, e.g. en, da, de.

## `concurrency` (type: `integer`):

How many pages to audit at the same time.

## `googleApiKey` (type: `string`):

Not required. Use your own PageSpeed Insights API key if you need very large daily volumes.

## Actor input object example

```json
{
  "urls": [
    "https://apify.com",
    "https://example.com"
  ],
  "maxUrls": 100,
  "strategies": [
    "mobile"
  ],
  "categories": [
    "performance",
    "accessibility",
    "best-practices",
    "seo"
  ],
  "maxOpportunities": 5,
  "locale": "en",
  "concurrency": 4
}
```

# Actor output Schema

## `results` (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://apify.com",
        "https://example.com"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("fjordlabs/pagespeed-audit").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://apify.com",
        "https://example.com",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("fjordlabs/pagespeed-audit").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://apify.com",
    "https://example.com"
  ]
}' |
apify call fjordlabs/pagespeed-audit --silent --output-dataset

```

## MCP server setup

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

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/ybnNSR97EUWu1uSXQ/builds/zYvLLw8Ze0aISIh8d/openapi.json
