# Google PageSpeed Insights (`seemuapps/google-pagespeed-insights`) Actor

Run a list of URLs through Google PageSpeed Insights and get Lighthouse scores plus Core Web Vitals for each one.

- **URL**: https://apify.com/seemuapps/google-pagespeed-insights.md
- **Developed by:** [Andrew](https://apify.com/seemuapps) (community)
- **Categories:** SEO tools, AI, Developer tools
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $8.00 / 1,000 url analyzeds

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Google PageSpeed Insights

Run any list of URLs through Google PageSpeed Insights and get back Lighthouse scores plus Core Web Vitals in one clean dataset — no browser, no scraping, no setup.

### What you get

- **Lighthouse category scores** for performance, accessibility, best-practices, SEO, and PWA (0–100)
- **Core Web Vitals** per URL — LCP, FCP, CLS, TBT, Speed Index
- **Mobile or desktop strategy** — match the audit to the user agent your traffic actually comes from
- **Dataset row per URL** with status, scores, vitals, fetch time, and final resolved URL
- Error-tolerant — failed URLs are logged with the reason, the run continues with the rest

### Use cases

- **SEO audits** — bulk-score a client's entire URL list and surface the pages dragging the domain down
- **Agency client reports** — pull fresh Lighthouse numbers on a schedule and feed them straight into your reporting stack
- **Regression monitoring after deploys** — run the actor post-release and diff scores against the previous build
- **Core Web Vitals tracking** — keep LCP, CLS, and TBT in a single table so you can watch trends over time
- **Competitor benchmarking** — score competitor URLs alongside your own and see exactly where you stand

### How to use

1. Paste your URLs into the **URLs** field — one per entry, full `https://` URLs
2. Choose a **Strategy** (`mobile` or `desktop` — default `mobile`, matching how Google ranks)
3. Adjust **Categories** if needed (default: performance, SEO, accessibility, best-practices)
4. Run the actor — results stream into the **Dataset** as each URL finishes
5. Export the dataset as CSV or JSON, or pull it via the Apify API for your own pipeline

### Output format

Each dataset record:

```json
{
  "url": "https://www.apify.com",
  "status": "success",
  "strategy": "mobile",
  "performanceScore": 87,
  "accessibilityScore": 95,
  "bestPracticesScore": 100,
  "seoScore": 92,
  "pwaScore": null,
  "lcp": 2410.5,
  "fcp": 1320.2,
  "cls": 0.04,
  "tbt": 180,
  "speedIndex": 2890.7,
  "fetchTime": "2024-11-04T12:34:56.789Z",
  "finalUrl": "https://www.apify.com/",
  "error": null
}
````

Scores are 0–100 (rounded from Lighthouse's 0–1 scale). Core Web Vitals are in milliseconds, except CLS which is unitless. If a URL fails, `status` is `"error"`, all metrics are `null`, and `error` contains the reason — the run keeps going with the remaining URLs.

### Notes

- PageSpeed Insights can be slow (sometimes 20–40 seconds per URL) because Lighthouse runs a real audit on Google's infrastructure. Each request has a 60-second timeout.
- Only categories you request are scored — leaving `pwa` out of the input keeps `pwaScore` as `null` in the output.

# Actor input Schema

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

List of URLs to audit with Google PageSpeed Insights.

## `strategy` (type: `string`):

Whether to run the Lighthouse audit as a mobile or desktop client.

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

Lighthouse categories to evaluate. Supported values: performance, accessibility, best-practices, seo, pwa.

## Actor input object example

```json
{
  "urls": [
    "https://www.apify.com",
    "https://www.google.com"
  ],
  "strategy": "mobile",
  "categories": [
    "performance",
    "seo",
    "accessibility",
    "best-practices"
  ]
}
```

# Actor output Schema

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

One record per URL: url, status (success|error), category scores (performance, accessibility, best-practices, seo, pwa), Core Web Vitals (lcp, fcp, cls, tbt, speedIndex), fetchTime, finalUrl, error.

# 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://www.apify.com",
        "https://www.google.com"
    ]
};

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

# Run the Actor and wait for it to finish
run = client.actor("seemuapps/google-pagespeed-insights").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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://www.apify.com",
    "https://www.google.com"
  ]
}' |
apify call seemuapps/google-pagespeed-insights --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=seemuapps/google-pagespeed-insights",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Google PageSpeed Insights",
        "description": "Run a list of URLs through Google PageSpeed Insights and get Lighthouse scores plus Core Web Vitals for each one.",
        "version": "1.0",
        "x-build-id": "FbzJPKcAknbWcAtwe"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/seemuapps~google-pagespeed-insights/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-seemuapps-google-pagespeed-insights",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/seemuapps~google-pagespeed-insights/runs": {
            "post": {
                "operationId": "runs-sync-seemuapps-google-pagespeed-insights",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/seemuapps~google-pagespeed-insights/run-sync": {
            "post": {
                "operationId": "run-sync-seemuapps-google-pagespeed-insights",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "urls"
                ],
                "properties": {
                    "urls": {
                        "title": "URLs",
                        "type": "array",
                        "description": "List of URLs to audit with Google PageSpeed Insights.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "strategy": {
                        "title": "Strategy",
                        "enum": [
                            "mobile",
                            "desktop"
                        ],
                        "type": "string",
                        "description": "Whether to run the Lighthouse audit as a mobile or desktop client.",
                        "default": "mobile"
                    },
                    "categories": {
                        "title": "Categories",
                        "type": "array",
                        "description": "Lighthouse categories to evaluate. Supported values: performance, accessibility, best-practices, seo, pwa.",
                        "items": {
                            "type": "string"
                        },
                        "default": [
                            "performance",
                            "seo",
                            "accessibility",
                            "best-practices"
                        ]
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
