# AI Search Visibility Auditor (`codepal/ai-search-visibility-auditor`) Actor

Check if ChatGPT, Claude, Perplexity and Gemini can find, read and cite your website. Audits AI crawler access, firewall blocks, JS rendering, schema, llms.txt and citability, generates llms.txt, and tracks your brand's share of voice in AI answers.

- **URL**: https://apify.com/codepal/ai-search-visibility-auditor.md
- **Developed by:** [Jared Keanche](https://apify.com/codepal) (community)
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.00 / 1,000 page auditeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## AI Search Visibility Auditor

**Can ChatGPT, Claude, Perplexity, Gemini and Copilot find, read and cite your website? And when customers ask AI for recommendations, do they hear your name, or your competitor's?**

This Actor audits any website for AI search (also called GEO / AEO / LLM SEO) and, optionally, measures your brand's share of voice in real AI answers. You get a score, a prioritised fix list, a ready-to-upload `llms.txt`, and a trend over time.

### What it checks

#### 1. Can AI crawlers get in?

- **robots.txt per AI bot**: OAI-SearchBot, ChatGPT-User, GPTBot, Claude-SearchBot, Claude-User, ClaudeBot, PerplexityBot, Perplexity-User, Googlebot, Google-Extended, Bingbot, Applebot-Extended, Meta-ExternalAgent, CCBot, Amazonbot, Bytespider. Parsed per RFC 9309 (longest match, wildcards, `$`).
- **Search bots vs training bots**: blocking *search* bots removes you from AI answers (critical). Blocking *training* bots is a business choice (reported, low severity).
- **Live firewall/CDN test**: fetches your home page with each bot's user agent. This catches the very common case where robots.txt allows AI bots but Cloudflare/WAF "Block AI bots" or Bot Fight Mode returns 403 or a challenge.

#### 2. Can they read the page?

- **JavaScript rendering**: most AI crawlers do not run JavaScript. Pages that are an empty React/Vue/Angular shell are flagged critical.
- `noindex`, `nosnippet`, `max-snippet:0`, `noai`, `X-Robots-Tag` headers, canonical pointing elsewhere, HTTP errors, slow responses, huge HTML.

#### 3. Can they understand and quote it?

- Title, meta description, single H1, subheadings, `lang`.
- **Structured data** (JSON-LD + microdata): Organization/LocalBusiness on the home page with `sameAs`, plus Article, Product, Service, FAQPage. Invalid JSON-LD is flagged.
- **Citability signals**: FAQ / question-style headings, concrete figures (prices, %, years, customers), lists and tables, author, last-updated date and content age, outbound references.
- **Site files**: `llms.txt` (validated against llmstxt.org), `llms-full.txt`, XML sitemap and `<lastmod>`, HTTPS.

#### 4. (Optional) Are you in the answers?

Ask AI models the questions your customers ask (e.g. *"Best solar installer in Nairobi?"*). For every answer the Actor records whether your brand is mentioned, its **position**, which competitors appear, **other brands AI recommends that you are not tracking**, and whether your domain is cited. It summarises:

- brand mention rate, average position, top-3 rate
- **share of voice** vs your competitors
- per-question wins and gaps
- **change since last run** (same Monitor name): questions gained and lost

Works with any OpenAI-compatible API using **your own key**: OpenAI, or OpenRouter to query Claude, Gemini, Llama, Mistral and Perplexity models through one key, plus Groq, Together, Azure or a local model.

### Output

| Where | What |
|---|---|
| Dataset, view **Site scores** | One row per site: score 0–100, grade A–F, blocked AI search/training bots, pages needing JS, top 15 fixes with how-to |
| Dataset, view **Page audits** | One row per page: score, words, JS needed, indexable, schema types, FAQ, facts, freshness, issues + fixes |
| Dataset, view **AI answers** | One row per answer: question, model, brand mentioned/position, competitors, other brands, sources, answer text |
| `REPORT` | Shareable HTML report |
| `LLMS_TXT_<domain>` | Generated llms.txt to upload to your site root |
| `AI_VISIBILITY` | Share-of-voice summary and changes |
| `SUMMARY` | Compact JSON for automations |

Example site row (shortened):

```json
{
  "record_type": "site", "site": "https://www.example.co.ke", "ai_visibility_score": 58, "grade": "D",
  "blocked_ai_search_bots": ["PerplexityBot"], "blocked_ai_training_bots": ["GPTBot"],
  "pages_audited": 20, "pages_needing_javascript": 6, "llms_txt": { "found": false },
  "top_fixes": [{ "severity": "critical", "check": "javascript", "example": "Only 12 words visible without JavaScript…", "fix": "Use server-side rendering or pre-rendering…", "pages": 6 }]
}
```

### How the score works

Each page starts at 100 and loses points per issue (critical 30, high 15, medium 8, low 3), with small bonuses for FAQ, rich schema, concrete facts and authorship. The site checks score works the same way. The **site score = 50 % site checks + 50 % average page score**. The AI answer score = 70 × mention rate + up to 30 for a high average position.

### Use cases

- **Agencies**: sell a "Can ChatGPT find you?" audit; run it on a prospect and three competitors and send the HTML report.
- **Marketing teams**: schedule weekly brand tracking with a webhook to Slack and catch drops early.
- **Developers**: verify a Cloudflare or WAF change didn't lock out AI search bots; check SSR after a frontend migration.

### Tips

- Start with 20 pages per site. Raise it to 100+ for a full content audit.
- Use 3–5 samples per question for stable share of voice. AI answers vary.
- Ask questions the way customers ask them, including location and budget.
- The live bot test uses the bots' user agents from Apify's IP addresses. Some firewalls verify real bot IPs, so a site can pass here and still block real bots (and vice versa). Treat a block as a strong signal to check your CDN settings.

### Limits & responsible use

- Only public pages are fetched, at a gentle rate, and robots.txt is respected by default.
- AI answers are a sample in time, not a guarantee of what every user sees.
- This Actor does not send your API key anywhere except the base URL you set.

### Pricing

Pay per event: $0.02 per website, $0.004 per page, $0.005 per AI answer (see PRICING.md). Your AI token costs are billed by your provider.

# Actor input Schema

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

Home page or any page of each website. Pages on the same site are grouped; the auditor also adds pages from the sitemap and home-page links.

## `maxPagesPerSite` (type: `integer`):

How many pages to audit per website (home page included). Each page is one billable event.

## `includeSitemapPages` (type: `boolean`):

Audit pages listed in sitemap.xml in addition to your start URLs and home-page links.

## `testBotAccess` (type: `boolean`):

Fetch the home page with each AI bot's user agent to catch CDN/firewall blocks (e.g. Cloudflare 'Block AI bots') that robots.txt does not show.

## `respectRobotsTxt` (type: `boolean`):

Skip pages your robots.txt disallows for all crawlers.

## `generateLlmsTxt` (type: `boolean`):

Save a ready-to-upload llms.txt for each site in the key-value store (LLMS_TXT\_<domain>).

## `checkAiAnswers` (type: `boolean`):

Ask AI models the questions your customers ask and measure how often (and how high) your brand is recommended vs competitors. Uses your own API key.

## `brandName` (type: `string`):

Your brand or business name as customers know it.

## `brandAliases` (type: `array`):

Short names, old names or product names that count as a mention.

## `brandDomain` (type: `string`):

Your domain (e.g. acme.co.ke) to detect when AI cites your site. Defaults to the first website above.

## `competitors` (type: `array`):

One per line. Optionally add the domain after a pipe: 'SunKing|sunking.com'.

## `questions` (type: `array`):

e.g. 'Best solar installer in Nairobi', 'Which CRM is best for small businesses in Kenya?'. Each question × model × sample is one AI answer.

## `aiModels` (type: `array`):

Model names for your API provider. Add several to compare models.

## `aiBaseUrl` (type: `string`):

Any OpenAI-compatible Chat Completions API: OpenAI (default), OpenRouter (https://openrouter.ai/api/v1, lets you query Claude, Gemini, Perplexity, Llama…), Groq, Together, Azure, or a local server.

## `aiApiKey` (type: `string`):

Your key for the provider above. Stored encrypted; you pay the provider directly for tokens.

## `samplesPerQuestion` (type: `integer`):

AI answers vary; ask each question several times for a more stable share of voice.

## `monitorName` (type: `string`):

Runs with the same name are compared, so scheduled runs show gains and losses since last time.

## `webhookUrl` (type: `string`):

Optional. Receives a JSON summary with a 'text' field (works with Slack/Teams/Discord-compatible webhooks, Zapier, Make, n8n).

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.example.com/"
    }
  ],
  "maxPagesPerSite": 20,
  "includeSitemapPages": true,
  "testBotAccess": true,
  "respectRobotsTxt": true,
  "generateLlmsTxt": true,
  "checkAiAnswers": false,
  "questions": [
    "What are the best options for <your product or service> in <your city>?"
  ],
  "aiModels": [
    "gpt-4o-mini"
  ],
  "aiBaseUrl": "https://api.openai.com/v1",
  "samplesPerQuestion": 1,
  "monitorName": "default"
}
```

# Actor output Schema

## `sites` (type: `string`):

One row per website with score, grade, AI crawler access and top fixes.

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

One row per audited page with score and issues.

## `answers` (type: `string`):

Each AI answer with brand position and competitors mentioned.

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

Shareable visual report.

## `aiVisibility` (type: `string`):

Brand mention rate, average position, share of voice vs competitors and change since last run.

## `files` (type: `string`):

SUMMARY, REPORT, AI_VISIBILITY and LLMS_TXT\_<domain> files.

# 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": [
        {
            "url": "https://www.example.com/"
        }
    ],
    "questions": [
        "What are the best options for <your product or service> in <your city>?"
    ],
    "aiModels": [
        "gpt-4o-mini"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("codepal/ai-search-visibility-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": [{ "url": "https://www.example.com/" }],
    "questions": ["What are the best options for <your product or service> in <your city>?"],
    "aiModels": ["gpt-4o-mini"],
}

# Run the Actor and wait for it to finish
run = client.actor("codepal/ai-search-visibility-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": [
    {
      "url": "https://www.example.com/"
    }
  ],
  "questions": [
    "What are the best options for <your product or service> in <your city>?"
  ],
  "aiModels": [
    "gpt-4o-mini"
  ]
}' |
apify call codepal/ai-search-visibility-auditor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,codepal/ai-search-visibility-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/BYd5Fz4Pe0Fd8jlim/builds/YUPX816h96sR3aEmJ/openapi.json
