# Lighthouse Audit (`microworlds/lighthouse-audit`) Actor

Automatically test the speed of your web pages and get daily or weekly detailed performance reports using Google's Lighthouse for Chrome. Ensure your website remains fast even as you add new features and pages. Export the result in ZIP and MHTML files

- **URL**: https://apify.com/microworlds/lighthouse-audit.md
- **Developed by:** [Caleb David](https://apify.com/microworlds) (community)
- **Categories:** SEO tools, Automation, Developer tools
- **Features:** Full permissions
- **Stats:** 94 total users, 0 monthly users, 100.0% runs succeeded, 2 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

## Google Lighthouse Audit

Automatically test the speed of your public web pages and get daily or weekly detailed performance reports using Google's Lighthouse for Chrome. Ensure your website remains fast even as you add new features and pages. Export the result in ZIP and MHTML files

### Use Cases & Benefits of Lighthouse Audits

➡️ **Performance Insights**: Google Lighthouse provides valuable performance metrics and recommendations to optimize the loading speed and overall performance of web pages or web applications.

➡️ **Accessibility Evaluation**: It assesses web content for accessibility, identifying potential issues and offering suggestions to improve the user experience for individuals with disabilities.

➡️ **Best Practices Analysis**: Lighthouse evaluates a website against a set of best practices and industry standards, highlighting areas that can be improved to ensure compatibility, security, and usability.

➡️ **SEO Optimization**: It provides insights into how well a webpage is optimized for search engines, offering suggestions to improve metadata, headings, and other elements that impact search engine rankings.

➡️ **Progressive Web App (PWA) Assessment**: Lighthouse evaluates the readiness and quality of a web application to function as a Progressive Web App, including offline support, push notifications, and other PWA features.

➡️ **Usability and User Experience (UX) Evaluation**: Lighthouse analyzes a website's UX, identifying issues related to mobile-friendliness, tap targets, font sizes, and other aspects that affect the overall usability and user experience.

### Sample input

The actor generates the report when you provide at barest minimum, the URL(s) of the site. You can either choose between either mobile or desktop mode.

```json
{
    "device": "desktop",
    "maxConcurrency": 2,
    "maxRequestRetries": 3,
    "maxRequestsPerCrawl": 500,
    "proxyConfig": {
        "useApifyProxy": true
    },
    "urls": [
        "https://apify.com/",
        "https://github.com"
    ]
}
```

### Output

The result, a ZIP file containing the actual report file, is stored to the [KeyValueStore](https://crawlee.dev/api/core/class/KeyValueStore) with a filename similar to `report-apify.com-2023-06-07-16-51-45-815-513c73432e.zip`. Download the ZIP file and extract the MHTML file containing the actual audit report.

### Cost of usage

Apify generously offers you $5 free usage credits monthly. From our tests, you can run up to 1,000 audits.

# Actor input Schema

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

URL of websites to run your audit on

## `device` (type: `string`):

You can run lighthouse audits on different types of devices. Desktop is selected by default

## `maxRequestsPerCrawl` (type: `integer`):

Maximum number of URLs to crawl for this run

## `maxConcurrency` (type: `integer`):

Maximum of of active instances

## `maxRequestRetries` (type: `integer`):

Set the max request retries

## `proxyConfig` (type: `object`):

This is required if you want to use Apify Proxy.

## Actor input object example

```json
{
  "urls": [
    "https://apify.com/"
  ],
  "device": "desktop",
  "maxRequestsPerCrawl": 500,
  "maxConcurrency": 5,
  "maxRequestRetries": 3,
  "proxyConfig": {
    "useApifyProxy": true
  }
}
```

# 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/"
    ],
    "device": "desktop",
    "maxRequestsPerCrawl": 500,
    "maxConcurrency": 5,
    "maxRequestRetries": 3,
    "proxyConfig": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("microworlds/lighthouse-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/"],
    "device": "desktop",
    "maxRequestsPerCrawl": 500,
    "maxConcurrency": 5,
    "maxRequestRetries": 3,
    "proxyConfig": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("microworlds/lighthouse-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/"
  ],
  "device": "desktop",
  "maxRequestsPerCrawl": 500,
  "maxConcurrency": 5,
  "maxRequestRetries": 3,
  "proxyConfig": {
    "useApifyProxy": true
  }
}' |
apify call microworlds/lighthouse-audit --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,microworlds/lighthouse-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/kkjqDHNFopnbseqhM/builds/7dI0Isybcpf7Wusy4/openapi.json
