# Canonical and Hreflang Checker - SEO Regression Audit (`variable_mitts/site-regression-auditor`) Actor

Check canonical tags, hreflang, noindex and redirects. Compare permitted page URLs against staging pages or saved baselines with release evidence.

- **URL**: https://apify.com/variable_mitts/site-regression-auditor.md
- **Developed by:** [Dhan sites](https://apify.com/variable_mitts) (community)
- **Categories:** SEO tools, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 90.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.28 / 1,000 successfully audited html pages

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## Canonical and Hreflang Checker - SEO Regression Audit

Check a bounded set of public pages before and after a website deployment.
Get URL-level canonical and hreflang observations, then select a previous baseline
storage to identify changes automatically. Useful for agencies reviewing translated sites
and teams checking metadata after a migration.

### Quick start

1. Add the exact HTML page URLs you want checked.
2. Allowed hostnames are inferred from the page URLs and their `www` variants
   when omitted. Add separate language hostnames explicitly if needed.
3. Confirm that you own the sites or have permission to audit them.
4. Start with a small page limit. Download the results and `BASELINE` record.
5. After your website changes, run the same URLs by selecting its earlier key-value store in
   `previousBaselineStoreId`. BASELINE is loaded automatically; no copying arrays. Compare equivalent samples.
   Pasted `baseline` rows remain supported as an alternative.

Example input (replace with your permitted website):

```json
{
  "startUrls": ["https://example.com/en", "https://example.com/fr"],
  "allowedHosts": ["example.com"],
  "maxPages": 20,
  "followAlternates": true,
  "permissionConfirmed": true
}
```

### Outputs

- **Page observations:** one dataset row per attempted URL, including status,
  canonicals, hreflang declarations and evidence. The table also shows whether
  a baseline comparison is available and how many observations changed.
- **REPORT:** complete JSON with coverage, changes and limitations.
- **BASELINE:** page rows to reuse in your next run. Store this yourself before
  your account's retention period expires.
- **ISSUES.csv:** one row per finding, with formula-like cells escaped for
  spreadsheet import.

An example observation is `RETURN_LINK_MISSING`, with both source page and
affected alternate URL. `ALTERNATE_UNCHECKED` means that target wasn't verified;
it does not mean the URL is broken. A failed baseline or current fetch is not
presented as a verified metadata change.

### What is checked

Static HTML head tags: missing/multiple canonical tags, canonical destinations,
noindex directives, duplicate hreflang declarations, self references, absolute
alternate URLs, reciprocal return links and target redirects within the sample.
The crawler may follow alternate URLs only on explicitly allowed hosts.

### Limits and interpretation

- Up to 100 attempted pages per run; default 20. No ordinary link crawling or
  sitemap discovery. There is a bounded request budget and a 75-second audit
  scheduling/body-read budget. A socket operation can extend past that budget;
  the cloud deployment has a separate 120-second run timeout.
- robots.txt is respected. Non-public IP addresses, unsupported ports,
  credentials in URLs, and off-allowlist destinations are blocked. Fetch errors
  and limits are visible in the report.
- No JavaScript rendering, XML sitemap annotations, HTTP Link-header annotations
  or hreflang language-code validation. Use on server-rendered HTML metadata.
- Missing or non-self canonical tags can be intentional. Observations are not
  automatic proof of an indexing problem or a guaranteed SEO improvement.
- `no_longer_observed` means absent in this sample, not independently verified
  fixed. Different crawl coverage can change the observations.
- The billing implementation supports a `page-audited` event only for checked
  HTML pages. Failed attempts remain uncharged. The selected spending limit
  caps attempted work before fetching. Consult the current Pricing tab for the
  effective offer. Current price: $1.6 per 1,000 successfully checked HTML pages,
  with no run-start fee.

### Troubleshooting

**No pages checked:** inspect HTTP status and `FETCH_FAILED` evidence; check
allowed hostnames, redirects and robots policy. No browser/proxy bypass is used.

**Alternate unchecked:** include that hostname and URL and allow enough pages.
Check whether the target failed or the report was truncated.

**No baseline comparison:** select the key-value store of an earlier complete run
in `previousBaselineStoreId`. Its BASELINE must still be retained. Apify grants
read-only access to the selected storage; it does not grant access to all your data. Alternatively paste rows into `baseline`;
do not provide both. Only checked pages in equivalent samples can be compared.

**Need support:** provide a run ID and a minimal reproducible example in the
Actor's Issues tab. Do not post private credentials or customer data.

### Repeat checks through the API

The API example below uses your token as a Bearer header, never a URL query.
First run your permitted URLs, retain the returned defaultKeyValueStoreId, then submit the same input
with `previousBaselineStoreId` set to that storage ID. The next run returns per-page changes and
its own BASELINE for subsequent comparisons. `REPORT.baseline_store_id` identifies
the comparison source. Deleted or expired baselines cause a clear error.

```bash
curl -X POST \
  https://api.apify.com/v2/acts/variable_mitts~site-regression-auditor/runs \
  -H "Authorization: Bearer $APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"startUrls":["https://books.toscrape.com/"],"maxPages":20,"permissionConfirmed":true}'
```

The URL above is the developer's demo site; use your own permitted site.
Check run status and download REPORT before trusting any comparison. Failed or
truncated coverage is not a clean result. Run limits remain 100 pages/75 seconds;
large sites need explicit batches. Links spanning separate batches may remain
unverified, so include the relevant language counterparts together.

For the second API run, add `"previousBaselineStoreId": "YOUR_PREVIOUS_STORE_ID"`
to the same input, replacing the placeholder with the first run's
`defaultKeyValueStoreId`. In Console, select that store with the storage picker.

### Example regression

For a two-language sample, both `/en` and `/fr` initially link to both language
versions. A later release removes the English return link from `/fr`:

| Observation | Before | After |
| --- | --- | --- |
| English page declares French alternate | Present | Present |
| French page links back to English | Present | Missing |
| `RETURN_LINK_MISSING` on English page | Absent | Added, with French URL as target |

This is a synthetic fixture demonstrating the behavior, not a customer result.
An unchanged real-page cloud comparison also verified zero new observations.
Use `added_issue_count`, `canonical_changed` and the REPORT changes to decide
which URLs need review. Incomplete coverage must not be treated as a clean audit.

### Who is this for?

SEO teams checking canonical and hreflang changes before a website release. Supply permitted page URLs and an optional baseline or comparison target.

### Frequently asked questions

#### Can this detect SEO changes between staging and production?

It compares supported page observations and reports canonical, hreflang, indexing and redirect differences. A first snapshot is a baseline, not a passed regression comparison. Review checked coverage and failed requests.

#### How do I try it before using my full input?

Open the Input tab, review the prefilled example, and run a small batch with a spending limit. Inspect the dataset and report before increasing the batch. Examples can incur the documented inspection or analysis fee; an execution marked successful can still contain rejected records or incomplete coverage.

#### Can I use the Actor through an API or on a schedule?

Yes. Use Apify's [Actor API](https://docs.apify.com/api/v2/acts-run-sync-get-dataset-items-post) or [schedules](https://docs.apify.com/platform/schedules). Keep credentials private and use the documented input fields. The pricing and limits below apply to API runs too.

### Related tools for the next step

- [Broken Internal Link Checker - Source Pages and Repair CSV](https://apify.com/variable_mitts/internal-link-source-checker)
- [JSON-LD Extractor - Structured Data and Syntax Checker](https://apify.com/variable_mitts/json-ld-page-extractor)

# Actor input Schema

## `startUrls` (type: `array`):

1â€“100 public HTML pages you have permission to audit. A small example is prefilled.

## `allowedHosts` (type: `array`):

Leave empty to infer exact hostnames and their www variants from Page URLs. Add separate language domains explicitly.

## `maxPages` (type: `integer`):

Maximum number of pages to attempt; incomplete targets remain explicitly unchecked.

## `followAlternates` (type: `boolean`):

Include discovered hreflang URLs only when their exact hostname is allowed.

## `permissionConfirmed` (type: `boolean`):

The example checks Books to Scrape, a public site built for scraping practice. For other URLs, confirm that you have permission before running.

## `baseline` (type: `array`):

Paste up to 100 rows from the previous BASELINE output.

## `previousBaselineStoreId` (type: `string`):

Select the key-value store from a previous complete run. Reads its BASELINE record with read-only access; no copying arrays required.

## Actor input object example

```json
{
  "startUrls": [
    "https://books.toscrape.com/"
  ],
  "allowedHosts": [
    "books.toscrape.com"
  ],
  "maxPages": 3,
  "followAlternates": true,
  "permissionConfirmed": true
}
```

# Actor output Schema

## `pages` (type: `string`):

No description

## `report` (type: `string`):

No description

## `baseline` (type: `string`):

No description

## `issuesCsv` (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 = {
    "startUrls": [
        "https://books.toscrape.com/"
    ],
    "allowedHosts": [
        "books.toscrape.com"
    ],
    "maxPages": 3,
    "permissionConfirmed": true
};

// Run the Actor and wait for it to finish
const run = await client.actor("variable_mitts/site-regression-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 = {
    "startUrls": ["https://books.toscrape.com/"],
    "allowedHosts": ["books.toscrape.com"],
    "maxPages": 3,
    "permissionConfirmed": True,
}

# Run the Actor and wait for it to finish
run = client.actor("variable_mitts/site-regression-auditor").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 '{
  "startUrls": [
    "https://books.toscrape.com/"
  ],
  "allowedHosts": [
    "books.toscrape.com"
  ],
  "maxPages": 3,
  "permissionConfirmed": true
}' |
apify call variable_mitts/site-regression-auditor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,variable_mitts/site-regression-auditor"
        }
    }
}
```

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/WrP7579XjzLjJYHbv/builds/oZccHeyj2alA51j6g/openapi.json
