How to Track Your Brand's Visibility in Claude Using the Anthropic API
Every article about Claude brand tracking tells you the same thing: buy a monitoring tool for $99-500/month.
Here’s another option. Build it yourself for about $7/day.
We built a Claude brand tracker using the Anthropic API with web search. We’ve been running 48 prompts daily against Claude Sonnet 4.6, parsing every response for brand mentions, citations, and competitive positioning. The whole thing is a single Python script. No SaaS subscription. No dashboard login. Full ownership of the data.
This is the guide we wish existed when we started. Working code, actual cost numbers, and what seven days of tracking data taught us about how Claude recommends brands.
Why Claude Needs Its Own Tracker
If you’re already monitoring ChatGPT or Gemini, you might assume Claude works similarly. It doesn’t.
Claude searches Brave, not Bing or Google. ChatGPT uses Bing. Gemini uses Google. Claude uses Brave Search. Your Google rankings don’t directly determine whether Claude finds you. We’ve seen brands ranking #1 on Google for a keyword that Claude never retrieves because Brave’s index ranks them differently.
Claude’s response patterns differ. In our tracking, a client appeared in 95% of branded queries across all four engines. But for discovery prompts (“best feedback kiosk for airports”), ChatGPT mentioned them 76% of the time while Claude hit 89%. For use-case prompts, the numbers flipped. Each engine has its own biases.
No monitoring tool covers Claude well. PEEC AI tracks ChatGPT, Gemini, Perplexity, and Google AI Overviews. But as of July 2026, Claude API tracking requires an enterprise account with most platforms, or isn’t offered at all. The API approach fills this gap.
What You Need
Three things:
-
An Anthropic API key. Sign up at console.anthropic.com. You’ll need credits loaded. A 48-prompt daily run costs roughly $5-8.
-
Python 3.9+ and the Anthropic SDK. Install with
pip install anthropic. -
A prompt library. A CSV file with 40-50 prompts that represent how buyers actually search. This is the part most people underestimate.
Building Your Prompt Library
The prompt library is the most important piece. Get this wrong and your tracking data means nothing.
Split prompts into four categories:
| Category | What it tests | Example | Expected mention rate |
|---|---|---|---|
| Branded | Does Claude know you exist? | “What is [Your Brand] and how does it work?” | 90-100% |
| Comparison | How do you stack up head-to-head? | “[Your Brand] vs [Competitor]” | 80-95% |
| Discovery | Does Claude recommend you unprompted? | “Best [category] software for [use case]” | 20-60% |
| Use-case | Do you show up for specific buyer needs? | “How to [solve problem] in [industry]” | 10-40% |
Why the split matters. If you track all prompts as one bucket, you’ll see a combined mention rate of, say, 67%. That number hides the real story. In our tracking, the client appeared in 95% of branded prompts but only 28% of use-case prompts. The aggregate number is meaningless. The gap between branded and discovery is the actual insight. (We break down why this split matters and how to calculate an AI visibility score in a separate guide.)
How many prompts per category. We use 8 branded, 6 comparison, 14 discovery (split between kiosk/category and broad voice-of-customer), and 20 use-case prompts. Weight discovery and use-case prompts more heavily. Those are the ones where you’ll find gaps worth closing.
Format. A simple CSV with semicolon delimiters works:
Prompts;Topic;Tag 1;Tag 2;Persona (also a tag)
What is [YourBrand] and how does it work?;Brand Awareness;Branded-Direct;;
[YourBrand] vs [Competitor A];Competitor;Comparison;;
Best [category] software for [industry];Category Discovery;Open-Discovery;Discovery-Kiosk;
How to [solve problem] in [industry];Use Case;Open-Discovery;Use-Case;
The Tracking Script
Here’s the core of the script. The full version handles rate limits, retries, and Excel workbook updates, but this is the part that matters.
Setting Up the API Call
import anthropic
client = anthropic.Anthropic() # uses ANTHROPIC_API_KEY env var
response = client.messages.create(
model="claude-sonnet-4-6",
max_tokens=1024,
system=(
"Answer in 2-3 short paragraphs. List specific product "
"and brand names. When comparing or recommending, use a "
"numbered list. Be direct and concise."
),
tools=[{
"type": "web_search_20250305",
"name": "web_search",
"max_uses": 5,
"user_location": {
"type": "approximate",
"country": "US",
},
}],
messages=[{"role": "user", "content": prompt_text}],
)
Three things worth noting:
The system prompt keeps costs down. “Answer in 2-3 short paragraphs” limits output tokens without changing which brands Claude mentions. We tested with and without the system prompt. Same brand mentions. Half the token cost.
max_uses: 5 caps search costs. Each web search costs $0.01. Without a cap, Claude might run 10+ searches on a comparative prompt. Five is enough for accurate results while keeping costs predictable.
user_location affects results. Claude localizes search results. If you’re tracking for a US audience, set the country. We saw different brand recommendations for the same prompt when switching between US and EU locations.
Handling pause_turn
Claude sometimes pauses mid-response when doing multiple searches. Your script needs to handle this:
while response.stop_reason == "pause_turn":
response = client.messages.create(
model="claude-sonnet-4-6",
max_tokens=1024,
system=system_prompt,
tools=[tool_def],
messages=[
{"role": "user", "content": prompt_text},
{"role": "assistant", "content": response.content},
],
)
Without this loop, you’ll get partial responses and incomplete data. About 15-20% of our prompts trigger at least one pause.
Parsing the Response
Claude’s API returns structured content blocks. Extract what you need:
def extract_text(response) -> str:
"""Pull assistant text from response blocks."""
parts = []
for block in response.content:
if hasattr(block, "text"):
parts.append(block.text)
return "\n".join(parts).strip()
def extract_citations(response) -> list:
"""Pull citation URLs from response blocks."""
citations = []
seen = set()
for block in response.content:
if hasattr(block, "citations") and block.citations:
for cite in block.citations:
if hasattr(cite, "url") and cite.url not in seen:
seen.add(cite.url)
citations.append({
"url": cite.url,
"title": getattr(cite, "title", ""),
})
return citations
Detecting Brand Mentions
Use regex patterns for each brand you’re tracking. Simple string matching misses variations. Multi-word brand names get split, hyphenated, and recombined in Claude’s responses. Regex handles all of it.
import re
BRAND_PATTERNS = {
"Your Brand": re.compile(r"your\s*brand", re.IGNORECASE),
"Competitor A": re.compile(r"competitor\s*a", re.IGNORECASE),
"Competitor B": re.compile(r"competitor\s*b", re.IGNORECASE),
}
def detect_mentions(text: str) -> list:
found = []
for brand, pattern in BRAND_PATTERNS.items():
if pattern.search(text):
found.append(brand)
return found
Finding Position
When Claude returns a numbered list of recommendations, position matters. Here’s how to extract it:
def find_position(text: str, brand_pattern) -> int | None:
lines = text.split("\n")
for line in lines:
stripped = line.strip()
num_match = re.match(r"^[#\s]*(\d+)[\.\):\s]", stripped)
if num_match and brand_pattern.search(stripped):
return int(num_match.group(1))
return None
Position 1 means Claude listed your brand first. In our tracking, the client held position 1 in 85% of prompts where it was mentioned. Position consistency is a stronger signal than mention rate alone.
What Seven Days of Data Looks Like
We ran this tracker daily for a client in the customer feedback space. Here’s what the data revealed.
Overall mention rate: 67%. Claude mentioned the client in 32 of 48 prompts on average. But that number hides the real story.
The branded vs. discovery gap:
| Prompt category | Mention rate | Avg. position |
|---|---|---|
| Branded | 95% | 1.0 |
| Comparison | 88% | 1.1 |
| Discovery (kiosk) | 62% | 1.2 |
| Discovery (VoC) | 71% | 1.4 |
| Use-case | 28% | 2.1 |
Claude knows the brand. But when someone asks “how to collect patient feedback in a hospital” or “best way to measure customer satisfaction in grocery stores,” Claude doesn’t connect those problems to this solution.
Consistency matters more than single-day scores. 28 prompts produced the same result every single day. 10 prompts never mentioned the brand. The interesting ones are the 10 “swing” prompts that flip between mentioning and not mentioning. Those are where optimization effort should focus.
Cost for the week: $46.82. That’s 48 prompts x 7 days. Average $6.69/day. Comparable to what monitoring SaaS tools charge monthly, but you own the raw data, the response text, and every citation URL.
Automating Daily Runs
On macOS, use launchd to run the script at 4 AM daily:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.yourcompany.claude-audit</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/python3</string>
<string>/path/to/run_claude_audit.py</string>
</array>
<key>EnvironmentVariables</key>
<dict>
<key>ANTHROPIC_API_KEY</key>
<string>sk-ant-...</string>
</dict>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>4</integer>
<key>Minute</key>
<integer>0</integer>
</dict>
</dict>
</plist>
On Linux, a cron job works:
0 4 * * * ANTHROPIC_API_KEY=sk-ant-... /usr/bin/python3 /path/to/run_claude_audit.py
The script writes each day’s results to a timestamped CSV (claude-audit-2026-07-08.csv) and updates an Excel workbook with daily tabs and a summary sheet. After a week, you have a trend line. After a month, you have a baseline worth acting on.
Cost Breakdown
Here’s what 48 prompts/day actually costs:
| Cost component | Per prompt | Per day (48) | Per month |
|---|---|---|---|
| Web searches (~3 avg) | $0.03 | $1.44 | $43.20 |
| Input tokens | ~$0.04 | ~$1.92 | ~$57.60 |
| Output tokens | ~$0.06 | ~$2.88 | ~$86.40 |
| Total | ~$0.13 | ~$6.24 | ~$187 |
Compare that to monitoring SaaS:
| Tool | Monthly cost | Claude coverage |
|---|---|---|
| Otterly.ai | $29+ | Basic |
| PEEC AI | $95-505 | Enterprise only |
| GrackerAI | $99-499 | Limited |
| Profound | $99-399+ | Included |
| DIY (this approach) | ~$187 | Full control |
The DIY approach sits in the mid-tier price range but gives you something no SaaS tool does: the raw response text for every prompt, every day. That text is where the qualitative insights live. How does Claude describe your brand? What adjectives does it use? Does it recommend you or just mention you? SaaS dashboards reduce responses to mention counts and position numbers. The full text tells a richer story.
What to Do With the Data
Tracking is not the end. It’s the diagnostic. Here’s what to look for:
1. Find the branded vs. discovery gap. If you’re at 95% branded and 28% use-case, the problem isn’t brand awareness. It’s that Claude doesn’t associate your brand with the problems your buyers are trying to solve. Fix this with content that connects your product to specific use cases. Our guide on how to appear in ChatGPT results covers the five actions that close this gap across all AI engines.
2. Identify swing prompts. Prompts that flip between mentioning and not mentioning your brand are the ones closest to tipping. A single well-placed review, comparison article, or case study on a third-party site can flip a swing prompt permanently.
3. Watch competitor patterns. Your tracker logs every brand mentioned, not just yours. When a competitor appears in 80% of discovery prompts and you appear in 28%, you can see exactly which prompts they’re winning. Read the full response text to understand why.
4. Track citation domains. Claude cites its sources. The citation URLs tell you which third-party sites Claude trusts for your category. If G2, Capterra, or a specific review site appears repeatedly, that’s where your citation surface needs strengthening.
Frequently Asked Questions
Can you track brand mentions in Claude programmatically?
Yes. The Anthropic API includes a web search tool that lets Claude search the web and cite sources, exactly like the consumer UI. You send prompts via the API, parse the response for brand mentions, extract citation URLs, and log everything to a CSV. No scraping required.
How much does it cost to track brand visibility in Claude via the API?
About $5-8 per day for a 48-prompt library running on Claude Sonnet 4.6. Web searches cost $10 per 1,000, and each prompt uses 2-5 searches. Add token costs and you’re looking at roughly $150-240 per month. Comparable to mid-tier monitoring SaaS but with full data ownership.
Does Claude use Google or Bing for web search?
Neither. Claude’s web search is powered by Brave Search. Your Google rankings don’t directly determine whether Claude finds you. If your pages aren’t indexed or ranking well in Brave, Claude may not retrieve them during live queries.
Why track Claude separately from ChatGPT and Gemini?
Claude uses a different search index (Brave vs. Bing vs. Google), different retrieval logic, and different response patterns. In our tracking, brands that appeared in 80%+ of ChatGPT responses sometimes showed up in fewer than 40% of Claude responses for the same prompts. Each engine needs its own baseline.
How many prompts do I need for reliable Claude tracking?
At minimum 30, ideally 40-50. Split them across branded queries, competitor comparisons, category discovery prompts, and use-case queries. The split matters because branded and discovery prompts produce very different mention rates, and tracking them together hides the real pattern.
What data can you extract from Claude API responses?
Brand mentions in the response text, position relative to competitors, citation URLs with source domains, web search result URLs that Claude retrieved, and the full response text for sentiment analysis. The API returns structured content blocks that make parsing straightforward.
Can I use the Claude API Batch endpoint for brand tracking?
Yes. The Anthropic Messages Batches API supports web search at the same price. Batches are throttled for web search, so large prompt sets may take longer. For daily monitoring of 50 prompts, real-time API calls finish in about 15 minutes.
How often should I run Claude brand tracking?
Daily if you’re establishing a baseline or running a campaign. Weekly once you have 2-3 weeks of daily data and understand your variance. Claude’s responses are non-deterministic, so the same prompt can produce different brand mentions on different days. Daily tracking reveals which prompts are stable and which swing.