npm package: @searchops/n8n-nodes-pagespeed
Description: n8n node for Google PageSpeed Insights API - Analyze web page performance, SEO, accessibility, and best practices
Author: SearchOps
Latest version: 1.0.2

# n8n-nodes-pagespeed

This is an n8n community node that integrates with the [Google PageSpeed Insights API](https://developers.google.com/speed/docs/insights/v5/get-started). Analyze web page performance, SEO, accessibility, and best practices.

[n8n](https://n8n.io/) is a [fair-code licensed](https://docs.n8n.io/reference/license/) workflow automation platform.

## Installation

Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes/installation/) in the n8n community nodes documentation.

### npm

```bash
npm install @searchops/n8n-nodes-pagespeed
```

### n8n GUI

1. Go to **Settings > Community Nodes**
2. Select **Install**
3. Enter `@searchops/n8n-nodes-pagespeed`
4. Agree to the risks and select **Install**

## Credentials

This node can work with or without an API key:

- **Without API key**: Works but with lower rate limits
- **With API key**: Recommended for production use with higher rate limits

### Getting an API Key

1. Go to [Google Cloud Console](https://console.cloud.google.com/)
2. Create a new project or select an existing one
3. Enable the [PageSpeed Insights API](https://console.cloud.google.com/apis/library/pagespeedonline.googleapis.com)
4. Go to [Credentials](https://console.cloud.google.com/apis/credentials)
5. Click **Create Credentials > API Key**
6. Copy the API key and add it to n8n credentials

## Node Reference

### Operations

The node performs a PageSpeed analysis on the specified URL.

### Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| URL | String | Yes | The URL of the page to analyze |
| Strategy | Options | No | `mobile` (default) or `desktop` |
| Categories | Multi-select | No | Categories to analyze: Performance, SEO, Accessibility, Best Practices |
| Simplified Output | Boolean | No | Return simplified metrics (default) or full API response |

### Options

| Option | Type | Description |
|--------|------|-------------|
| Locale | String | Locale for formatted results (e.g., `en`, `pt-BR`, `es`) |
| UTM Campaign | String | Campaign name for analytics |
| UTM Source | String | Campaign source for analytics |

### Output

#### Simplified Output (default)

```json
{
  "requestedUrl": "https://example.com",
  "finalUrl": "https://example.com/",
  "fetchTime": "2024-01-15T12:00:00.000Z",
  "strategy": "mobile",
  "scores": {
    "performance": 95,
    "accessibility": 100,
    "seo": 92,
    "bestPractices": 100
  },
  "metrics": {
    "firstContentfulPaint": {
      "score": 0.99,
      "value": 1234,
      "displayValue": "1.2 s"
    },
    "largestContentfulPaint": {
      "score": 0.95,
      "value": 2345,
      "displayValue": "2.3 s"
    },
    "cumulativeLayoutShift": {
      "score": 1,
      "value": 0.001,
      "displayValue": "0.001"
    },
    "totalBlockingTime": {
      "score": 0.98,
      "value": 50,
      "displayValue": "50 ms"
    },
    "speedIndex": {
      "score": 0.97,
      "value": 1500,
      "displayValue": "1.5 s"
    }
  },
  "fieldData": {
    "origin": "url",
    "metrics": {
      "CUMULATIVE_LAYOUT_SHIFT_SCORE": {
        "percentile": 0,
        "category": "FAST"
      }
    }
  }
}
```

#### Full Output

When "Simplified Output" is disabled, the node returns the complete API response from Google PageSpeed Insights.

## Use Cases

- **Performance Monitoring**: Automatically check website performance on a schedule
- **SEO Auditing**: Analyze SEO scores across multiple pages
- **Competitive Analysis**: Compare your site's performance against competitors
- **CI/CD Integration**: Fail deployments if performance drops below threshold
- **Reporting**: Generate automated performance reports

## Example Workflows

### Basic Performance Check

1. Add a **Schedule Trigger** node
2. Add the **Google PageSpeed Insights** node
3. Configure the URL and categories
4. Add an **IF** node to check if performance score < 80
5. Send alert via Slack/Email if performance is low

### Bulk URL Analysis

1. Add a **Spreadsheet** node with URLs
2. Add the **Google PageSpeed Insights** node
3. Connect the URL field from the spreadsheet
4. Store results in a database or spreadsheet

## Resources

- [Google PageSpeed Insights API Documentation](https://developers.google.com/speed/docs/insights/v5/get-started)
- [n8n Community Nodes Documentation](https://docs.n8n.io/integrations/community-nodes/)
- [Core Web Vitals](https://web.dev/vitals/)

## License

[MIT](LICENSE)