# Resource Hints Auditor (`phoenix2810/resource-hints-auditor`) Actor

"Enrich public GitHub repository URLs with stars, forks, topics, license, activity, owner metadata, release data, and lead-scoring signals. Built for B2B lead generation, devtools research, and competitive intelligence."

- **URL**: https://apify.com/phoenix2810/resource-hints-auditor.md
- **Developed by:** [Sanskar Jaiswal](https://apify.com/phoenix2810) (community)
- **Categories:** SEO tools, Developer tools, Open source
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 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/platform/actors/running/actors-in-store#pay-per-usage

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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

## Resource Hints Auditor

Audit a public web page for resource hints (`<link rel="preload">`, `prefetch`, `preconnect`, `dns-prefetch`, `modulepreload`, `prerender`) in one API call. Returns per-hint analysis, crossorigin gaps, duplicates, a readiness score, letter grade, and Core Web Vitals recommendations. Built for performance engineers, SEO teams, and site migration QA.

### Use cases

- **Performance engineers** - verify preload, preconnect, and dns-prefetch hints are present and correctly configured before launches
- **SEO teams** - confirm resource hints survive CMS template changes and migrations
- **Site migration QA** - catch missing or broken resource hints when moving between frameworks, CDNs, or edge providers
- **Frontend platform teams** - monitor for duplicate hints, missing crossorigin attributes, and preload without `as` attributes
- **Agency consultants** - batch-audit client pages and return structured recommendations

### Input

| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| `startUrl` | string | yes | - | Public page URL to audit |
| `timeoutSeconds` | integer | no | `10` | Per-request timeout (3-30 seconds) |
| `maxHtmlBytes` | integer | no | `1048576` | Maximum HTML body size to download and parse (16 KB - 2 MB) |

#### Example input

```json
{
  "startUrl": "https://example.com",
  "timeoutSeconds": 10,
  "maxHtmlBytes": 1048576
}
```

### Output

A single dataset item with the full audit:

| Field | Type | Description |
|---|---|---|
| `inputUrl` | string | The URL provided as input |
| `finalUrl` | string | Final URL after redirects |
| `https` | boolean | Whether the final response was served over HTTPS |
| `hintCount` | integer | Total number of resource hint link tags found |
| `byType` | object | Count of hints grouped by rel type (preload, prefetch, preconnect, dns-prefetch, modulepreload, prerender) |
| `hints` | array | Per-hint analysis (see below) |
| `issues` | array | Aggregated issue descriptions across all hints |
| `score` | integer | Resource hints readiness score (0-100) |
| `grade` | string | Letter grade (A+, A, B, C, D, E, F) |
| `checkedAt` | string | ISO 8601 timestamp |
| `recommendations` | array | Actionable recommendations for improving resource hints |

#### `hints` array

Each entry contains:

| Field | Type | Description |
|---|---|---|
| `rel` | string | The resource hint rel value (preload, prefetch, preconnect, dns-prefetch, modulepreload, prerender) |
| `href` | string | The href attribute value (empty string if missing) |
| `as` | string | null | The as attribute value (e.g., font, script, style), or null if absent |
| `crossorigin` | string | null | The crossorigin attribute value (anonymous by default), or null if absent |
| `origin` | string | null | Resolved origin of the href (protocol + host), or null if unresolvable |
| `issues` | array | Issue descriptions for this specific hint |
| `recommendation` | string | null | Fix recommendation for this hint (null when the hint is well-formed) |

#### Hint rel types detected

| rel | Purpose | Common issues checked |
|---|---|---|
| preload | Prioritize late-discovered critical resources | missing `as`, missing `crossorigin` for `as=fetch` |
| preconnect | Warm TCP/TLS connections to third-party origins | missing `crossorigin` for cross-origin fonts |
| dns-prefetch | Resolve DNS for third-party hostnames early | missing `href` |
| prefetch | Fetch future-navigation resources during idle time | missing `href` |
| modulepreload | Fetch and parse ES modules early | missing `href` |
| prerender | Prerender a future page (legacy) | missing `href` |

All hints are also checked for duplicates (same `rel` + `href`) and missing `href`.

#### Grading scale

| Score range | Grade |
|---|---|
| 95-100 | A+ |
| 85-94 | A |
| 75-84 | B |
| 65-74 | C |
| 50-64 | D |
| 30-49 | E |
| 0-29 | F |

Scoring rewards the presence of preload, preconnect, modulepreload, dns-prefetch, and prefetch hints, then subtracts penalties for each issue (missing `as`, missing `crossorigin`, duplicates, missing `href`).

#### Example output

```json
{
  "inputUrl": "https://example.com",
  "finalUrl": "https://example.com/",
  "https": true,
  "hintCount": 3,
  "byType": {
    "preload": 1,
    "preconnect": 1,
    "dns-prefetch": 1
  },
  "hints": [
    {
      "rel": "preload",
      "href": "/font.woff2",
      "as": "font",
      "crossorigin": "anonymous",
      "origin": "https://example.com",
      "issues": [],
      "recommendation": null
    },
    {
      "rel": "preconnect",
      "href": "https://cdn.example.com",
      "as": null,
      "crossorigin": "anonymous",
      "origin": "https://cdn.example.com",
      "issues": [],
      "recommendation": null
    },
    {
      "rel": "dns-prefetch",
      "href": "//fonts.example.com",
      "as": null,
      "crossorigin": null,
      "origin": "https://fonts.example.com",
      "issues": [],
      "recommendation": null
    }
  ],
  "issues": [],
  "score": 95,
  "grade": "A+",
  "checkedAt": "2026-08-03T12:00:00.000Z",
  "recommendations": [
    "Resource hints look well-structured. Schedule this audit periodically to catch regressions."
  ]
}
```

### Security

- Only public HTTP/HTTPS URLs are accepted
- SSRF protection: localhost, private IPv4/IPv6, and DNS-resolving-to-private IPs are blocked
- URLs with embedded credentials are rejected
- Redirects are manually revalidated before following (max 3)
- HTML body is capped at `maxHtmlBytes` to prevent oversized responses
- No browser automation, no proxies, no cookies stored

### Pricing

Pay per event:

| Event | Price |
|---|---|
| Actor start | $0.005 |
| Page audited | $0.01 |

A single-page audit costs approximately $0.015.

### FAQ

**What are resource hints?**
Resource hints are `<link>` elements in the HTML `<head>` that tell the browser to perform networking or fetching work early: `preload`, `prefetch`, `preconnect`, `dns-prefetch`, `modulepreload`, and `prerender`. They improve Core Web Vitals by reducing latency for critical resources.

**How is this different from a general SEO meta tags auditor?**
A meta tags auditor checks title, description, Open Graph, Twitter Card, and canonical tags. This actor focuses exclusively on resource hints and their performance-critical attributes (`as`, `crossorigin`, duplicates, missing `href`), whichgeneric metadata actors do not cover.

**Does the actor check the HTTP Link response header for preload?**
No. This actor parses `<link>` tags in the HTML body only. Some servers send `Link: <...>; rel=preload; as=font` in response headers; that is a separate delivery mechanism. A dedicated preload-link-header auditor is a possible future actor.

**Can I audit multiple pages in one run?**
This actor audits one page per run. For bulk audits, schedule multiple runs.

**Does the actor follow redirects?**
Yes, up to 3 redirects. Each redirect target is revalidated for SSRF safety before it is followed.

# Actor input Schema

## `startUrl` (type: `string`):

Public page URL to audit. The actor fetches the HTML once and parses <link> resource hints. HTTP and HTTPS only. Private IP ranges are blocked.

## `timeoutSeconds` (type: `integer`):

Timeout for the HTTP request.

## `maxHtmlBytes` (type: `integer`):

Maximum HTML body size to download and parse.

## Actor input object example

```json
{
  "startUrl": "https://example.com",
  "timeoutSeconds": 10,
  "maxHtmlBytes": 1048576
}
```

# Actor output Schema

## `results` (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 = {
    "startUrl": "https://example.com"
};

// Run the Actor and wait for it to finish
const run = await client.actor("phoenix2810/resource-hints-auditor").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 = { "startUrl": "https://example.com" }

# Run the Actor and wait for it to finish
run = client.actor("phoenix2810/resource-hints-auditor").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 '{
  "startUrl": "https://example.com"
}' |
apify call phoenix2810/resource-hints-auditor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=phoenix2810/resource-hints-auditor",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/wokXr2HtL1j22awzr/builds/EemDK4822FnaH19Ea/openapi.json
