# Hreflang Tag Auditor (`bigibyte/hreflang-tag-auditor`) Actor

Instantly audit web pages for hreflang language and region alternates, self-references, and x-default tags. Export clean SEO and localization data to JSON, CSV, or Excel in seconds.

- **URL**: https://apify.com/bigibyte/hreflang-tag-auditor.md
- **Developed by:** [BigiByte](https://apify.com/bigibyte) (community)
- **Features:** Limited permissions
- **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/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

## Hreflang Tag Auditor

![Hreflang Tag Auditor cover](https://images.bigibyte.com/cdn-cgi/image/width=1260,height=540,fit=cover,format=webp/apify-actors-covers/hreflang-tag-auditor-cover.png)

Audit hreflang tags across public website pages with the Hreflang Tag Auditor. Submit a list of URLs to extract language and regional alternate links, check for `x-default` declarations, and identify missing self-references. Export structured audit results as JSON, CSV, Excel, or other supported dataset formats for international SEO and localization checks.

### What It Does

The Hreflang Tag Auditor visits each URL you provide, reads its HTML, and extracts alternate language declarations using `link rel="alternate"` hreflang tags.

Each successfully processed page produces a dataset record containing:

- **URL:** The audited page URL, including the final URL after redirects when available.
- **Hreflangs:** A list of language or region codes and their corresponding alternate URLs.
- **Has X-Default:** Indicates whether an `x-default` alternate is declared.
- **Has Self Reference:** Indicates whether an alternate URL matches the audited page URL.
- **Count:** Total number of extracted hreflang pairs.
- **Scraped At:** Timestamp indicating when the page was audited.

### Scraping Mode

#### Audit Pages

Use `mode: "audit"` to inspect the hreflang declarations on the URLs you provide.

The auditor processes each page individually and returns its alternate language references, declaration count, and validation flags. Pages without hreflang markup are still included with an empty `hreflangs` array.

### Input Example

```json
{
  "mode": "audit",
  "urls": [
    "https://www.nasa.gov/"
  ],
  "requestDelayMs": 1000,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

### Input Parameters

| Parameter | Type | Default | Description |
|---|---|---|---|
| `mode` | String | `audit` | Scraping mode. Only `audit` is supported. |
| `urls` | Array | `https://www.nasa.gov/` | List of website pages to audit. |
| `userAgent` | String | `ActorResearch/1.0` | User-Agent used for requests. |
| `requestDelayMs` | Integer | `1000` | Delay between requests in milliseconds. |
| `timeoutSecs` | Integer | `300` | Overall Actor run timeout in seconds. |
| `requestTimeoutSecs` | Integer | `30` | Maximum time allowed for an individual request. |
| `proxyConfiguration` | Object | Off | Optional proxy configuration. Disabled by default. |

### Output Examples

#### Page Without Hreflang Tags

```json
{
  "url": "https://www.nasa.gov/",
  "hreflangs": [],
  "hasXDefault": false,
  "hasSelfRef": false,
  "count": 0,
  "scrapedAt": "2026-10-26T00:00:00+00:00",
  "error": false
}
```

#### Page With Hreflang Alternates

```json
{
  "url": "https://example.org/en/",
  "hreflangs": [
    {
      "lang": "en",
      "href": "https://example.org/en/"
    },
    {
      "lang": "fr",
      "href": "https://example.org/fr/"
    },
    {
      "lang": "x-default",
      "href": "https://example.org/"
    }
  ],
  "hasXDefault": true,
  "hasSelfRef": true,
  "count": 3,
  "scrapedAt": "2026-10-26T00:00:00+00:00",
  "error": false
}
```

### Output Fields

| Field | Type | Description |
|---|---|---|
| `url` | String | Audited page URL, including the final URL after redirects when available. |
| `hreflangs` | Array | Extracted language or regional alternate pairs containing `lang` and `href`. |
| `hreflangs[].lang` | String | Language or region code declared in the hreflang attribute. |
| `hreflangs[].href` | String | Alternate page URL associated with the language or region. |
| `hasXDefault` | Boolean | Indicates whether an `x-default` declaration is present. |
| `hasSelfRef` | Boolean | Indicates whether an alternate URL matches the audited page URL. |
| `count` | Integer | Number of extracted hreflang pairs. |
| `scrapedAt` | String | ISO timestamp indicating when the page was audited. |
| `error` | Boolean | Indicates whether the record represents a failed request. Error records may include additional error details. |

### Use Cases

- **International SEO Audits:** Identify pages with missing hreflang declarations or missing `x-default` references.
- **Localization QA:** Check whether language and regional alternate URLs match the expected website structure.
- **Website Migration Checks:** Re-audit URLs after domain changes, redesigns, or international site migrations.
- **Technical SEO Monitoring:** Collect structured hreflang data for recurring website audits.
- **Competitor Research:** Review publicly declared language and regional alternatives across multilingual websites.
- **SEO Reporting:** Export audit results into spreadsheets for technical SEO teams and clients.

### Usage and Limits

- **URL-Based Auditing:** Only the URLs supplied in the `urls` input are fetched. The actor does not automatically discover additional website pages.
- **One Record Per Page:** Each processed URL produces an individual dataset record.
- **Duplicate Prevention:** Duplicate page URLs are skipped within the same run.
- **Request Pacing:** The default delay is approximately one second between requests.
- **Error Handling:** Failed requests produce error records without stopping the entire run.
- **HTML-Based Extraction:** The auditor reads hreflang declarations available in the fetched HTML. It does not claim to validate every SEO requirement or guarantee that alternate pages are reachable or correctly configured.

### Frequently Asked Questions

**What does the Hreflang Tag Auditor check?**

It extracts language and regional alternate URLs from HTML hreflang tags and reports whether an `x-default` declaration and a self-reference are present.

**What happens if a page has no hreflang tags?**

The page is still included in the dataset with an empty `hreflangs` array, a count of `0`, and the appropriate boolean flags set to `false`.

**Does it verify whether alternate URLs work?**

The documented functionality extracts declared alternate URLs. It does not independently confirm that every alternate destination is reachable or returns the correct language content.

**Can I export the results to Excel or CSV?**

Yes. You can export the dataset as JSON, CSV, Excel, and other supported Apify formats.

**Can I schedule recurring audits?**

Yes. Use Apify schedules to audit the same URL list automatically at your preferred intervals.

### Related Tools

Explore other BigiByte tools for website research and structured data collection:

- **INCIDecoder Skincare Ingredients Scraper** – Extract skincare product information and ingredient lists.
- **Parfumo Perfume Scraper** – Collect perfume names, brands, and ratings.
- **Microsoft Store Apps Scraper** – Gather structured application listings and product information.

Need to audit more than hreflang tags? BigiByte develops custom web scrapers and data extraction solutions for SEO audits, website analysis, and structured data collection.

Visit [BigiByte](https://bigibyte.com) to explore our solutions.

### Trademark Notice

All website names, logos, trademarks, and related brand assets belong to their respective owners. They are mentioned only to identify the websites being audited. This tool is independently developed and does not imply affiliation, sponsorship, endorsement, or partnership with any audited website.

### Disclaimer

This Actor is an independent website auditing tool. It is not affiliated with or endorsed by the websites being audited. The extracted information is provided for technical SEO research and informational purposes. Users are responsible for ensuring that their collection and use of website data comply with applicable laws and the source websites' terms.

### Is Web Scraping Legal?

This actor extracts publicly accessible information without bypassing login screens, paywalls, or technical security layers. While collecting public web data is widely permitted, compliance depends on how data is gathered and used:

- **Personal Data:** Follow applicable privacy regulations, including GDPR and CCPA, when handling personal information.
- **Copyrighted Content:** Respect intellectual property rights when collecting or reusing protected material.
- **Platform Terms and Rate Limits:** Review each website's terms and use reasonable request intervals.

This information is provided for general guidance only and does not constitute legal advice. For a more detailed explanation, read Apify's guide: [Is web scraping legal?](https://blog.apify.com/is-web-scraping-legal/).

# Actor input Schema

## `mode` (type: `string`):

What to scrape. Audit pages fetches each URL and extracts link rel=alternate hreflang pairs.

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

Pages to audit for hreflang tags.

## `userAgent` (type: `string`):

User-Agent header sent with each request.

## `requestDelayMs` (type: `integer`):

Milliseconds to wait between page requests.

## `timeoutSecs` (type: `integer`):

Overall run budget in seconds.

## `requestTimeoutSecs` (type: `integer`):

Per-request timeout in seconds.

## `proxyConfiguration` (type: `object`):

Optional proxy. Leave off unless you need it.

## Actor input object example

```json
{
  "mode": "audit",
  "urls": [
    "https://www.nasa.gov/"
  ],
  "userAgent": "ActorResearch/1.0",
  "requestDelayMs": 1000,
  "timeoutSecs": 300,
  "requestTimeoutSecs": 30,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `overview` (type: `string`):

Hreflang audit rows in the overview table.

## `dataset` (type: `string`):

Full dataset for this run.

## `items` (type: `string`):

Dataset items as JSON.

# 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.nasa.gov/"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("bigibyte/hreflang-tag-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 = { "urls": ["https://www.nasa.gov/"] }

# Run the Actor and wait for it to finish
run = client.actor("bigibyte/hreflang-tag-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 '{
  "urls": [
    "https://www.nasa.gov/"
  ]
}' |
apify call bigibyte/hreflang-tag-auditor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,bigibyte/hreflang-tag-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/aDwRfllQvI1owGD9S/builds/1hdvrseK6Ir1CPrFU/openapi.json
