Sub topic 5
Citations: which sources an answer links to
This chapter assumes you have read the chapters on mentions and prompt-set design. You should know what a recorded run is: one prompt sent to one engine at one time, with the answer text saved. Basic Python helps with the code. You should also be comfortable with URLs, domains, and ratios.
What a citation is
A citation is a source the answer points to, usually as a link, a numbered footnote, or an entry in a "Sources" panel. A mention is your brand's name appearing in the answer text. The two are separate events:
| Situation | Mention | Citation |
|---|---|---|
| Answer names Acme and links to acme.com | Yes | Yes |
| Answer names Acme, links only to a review site | Yes | No |
| Answer never names Acme, but links to acme.com/guide | No | Yes |
| Answer names neither and links elsewhere | No | No |
The third row is common. An engine can use your page as evidence and write the answer without naming you. Counting only mentions would miss that influence. Counting only citations would miss answers that recommend you from the model's own knowledge.
A citation also makes a weaker claim than it appears to. A link means the engine retrieved or attributed that page. It does not mean the answer text was drawn from it, or that the page supports the sentence next to it. Treat a citation as "this URL was shown as a source," and nothing stronger.
Where citations come from
Engines produce citations in different ways, and this affects what a tracker can see.
- Retrieval-grounded answers. The engine searches the web or an index, reads some pages, and writes an answer that links to them. Most visible citations come from this path.
- Answers from model memory. With no search step, an answer may have no links at all. A low citation rate on prompts like these is expected. It is not a failure to be fixed.
- Per-sentence versus per-answer sources. Some interfaces attach links to individual claims. Others list sources once at the end. The same page can be "cited" in both cases, but the evidence is stronger for the first.
- Shown versus retrieved. An engine may read ten pages and show four. You can only measure what is shown or returned in the data you collected.
Whether citations are present can depend on the collection method. A raw model API call often returns text with no sources unless a search or grounding option is enabled. An interface capture shows what a user sees. Compare a tool's citation numbers only against runs collected the same way.
What to record for each citation
Store citations as structured fields, not as text inside the answer. For each run, keep:
- The original URL exactly as returned.
- A normalized URL (see below).
- The host (domain).
- Rank order in the source list, if the engine shows one.
- Link title or snippet, if provided.
- Whether the link appeared inline, in a footnote, or in a source panel.
Keeping the original URL lets you re-parse later if your normalization rules change. Rank order matters because a first-listed source is more visible than a tenth-listed one. Chapter-level metrics usually ignore rank at first, but the field is cheap to store and impossible to recover afterward.
Normalizing URLs
Raw citation URLs are messy. The same page can appear in several forms:
https://www.acme.com/crmhttps://acme.com/crm/https://acme.com/crm?utm_source=chatgpt.com
If you count these as three sources, your page-level numbers are wrong. Normalization makes them one. A minimal set of rules:
- Lowercase the scheme and host.
- Remove a leading
www.. - Drop the URL fragment (the part after
#). - Remove tracking parameters such as
utm_*,gclid, andfbclid. - Remove a trailing slash from the path.
Be careful with query strings. Some sites use parameters to select content, for example ?id=42. Strip only parameters you know are tracking. Do not remove the whole query string.
Classifying sources
After normalization, assign each host a type. Three types cover most analysis:
- Own: your domain and its subdomains, such as
blog.acme.com. - Competitor: domains of brands you benchmark against.
- Third party: everything else, such as review sites, forums, news, encyclopedias, and video platforms.
Matching a domain needs care. host.endswith("acme.com") wrongly matches notacme.com. The safe test is host == "acme.com" or host.endswith(".acme.com").
The third-party group is usually the largest and often the most useful. If a review site appears in many answers for your category, that site shapes what engines say about you. The competitor benchmarking chapter returns to this. For now, record the type so you can aggregate it later.
Computing citation metrics
Three metrics come from this data. Define each one explicitly, because tools differ.
Citation rate is the share of runs in which at least one cited URL is on your domain:
citation rate = runs citing your domain / total runs
Count a run once, no matter how many of your pages it links. Otherwise one answer with five of your links outweighs five answers with one link each.
Any-citation rate is the share of runs that show any source at all. It tells you how often the engine uses sources for your prompt set. If it is 20%, your citation rate cannot be much higher than that.
Source share is the proportion of cited domains that belong to each type, or to each domain:
source share (own) = own-domain citations / all domain citations
Count each domain once per run. Otherwise a long answer with eight links to one review site would dominate the totals.
The script below applies these rules to four recorded runs.
from collections import Counter
from urllib.parse import urlparse, urlunparse, parse_qsl, urlencode
OWN_DOMAIN = "acme.com"
COMPETITOR_DOMAINS = {"globex.com", "initech.com"}
TRACKING_PARAMS = {"utm_source", "utm_medium", "utm_campaign",
"utm_term", "utm_content", "gclid", "fbclid"}
runs = [
{"prompt": "best crm for small teams",
"cited_urls": ["https://www.acme.com/crm?utm_source=chat",
"https://example.org/review/",
"https://acme.com/crm"]},
{"prompt": "crm with free plan",
"cited_urls": ["https://example.org/review",
"https://blog.acme.com/guide",
"https://globex.com/pricing"]},
{"prompt": "how to choose a crm", "cited_urls": []},
{"prompt": "crm integrations list",
"cited_urls": ["https://news.example.net/crm-roundup"]},
]
def normalize(url):
p = urlparse(url.strip())
host = (p.hostname or "").lower()
if host.startswith("www."):
host = host[4:]
query = urlencode([(k, v) for k, v in parse_qsl(p.query)
if k.lower() not in TRACKING_PARAMS])
path = p.path.rstrip("/") or "/"
return urlunparse((p.scheme.lower(), host, path, "", query, ""))
def matches(host, domain):
return host == domain or host.endswith("." + domain)
def classify(host):
if matches(host, OWN_DOMAIN):
return "own"
if any(matches(host, d) for d in COMPETITOR_DOMAINS):
return "competitor"
return "third_party"
domain_counts = Counter()
type_counts = Counter()
runs_with_any = 0
runs_with_own = 0
for run in runs:
urls = {normalize(u) for u in run["cited_urls"]}
hosts = {urlparse(u).hostname for u in urls}
if urls:
runs_with_any += 1
if any(classify(h) == "own" for h in hosts):
runs_with_own += 1
for h in hosts: # each domain counted once per run
domain_counts[h] += 1
type_counts[classify(h)] += 1
total_domain_citations = sum(type_counts.values())
print("any-citation rate:", runs_with_any / len(runs)) # 0.75
print("citation rate:", runs_with_own / len(runs)) # 0.5
print("source types:", dict(sorted(type_counts.items())))
# {'competitor': 1, 'own': 2, 'third_party': 3}
print("own source share:", round(type_counts["own"] / total_domain_citations, 2)) # 0.33
print("top domain:", domain_counts.most_common(1)) # [('example.org', 2)]Run 1 shows why normalization matters. The first and third URLs normalize to the same page, so it counts once. Run 2 shows subdomain handling: blog.acme.com counts as your own domain.
Page-level analysis
Domain-level rates tell you whether you are cited. Page-level counts tell you which pages are cited. Group normalized URLs, not hosts, and look for patterns:
- Which of your pages appear most often? These are the pages engines already trust for your topics.
- Which prompts cite your domain but never name your brand? These are mentions you are missing.
- Which prompts cite a competitor's page where you have a similar page? These are candidates for content review.
Page-level counts are small unless you run many prompts and repeats. Do not rank pages from one or two appearances.
Common errors
- Counting links instead of runs. Use "at least one own-domain link per run" for citation rate. Counting every link inflates rates for long source lists.
- Substring domain matching.
"acme.com" in urlmatcheshttps://example.org/?ref=acme.com. Parse the host first. - Treating redirects as separate sources. Some engines return a tracking or redirect URL rather than the final page. If you can resolve it, store both. If you cannot, say so in your methodology, because those citations may be undercounted for your domain.
- Mixing collection methods. An API run with search disabled and an interface capture are not comparable. Report citation rates per method.
- Comparing across engines without context. Engines differ in how many sources they show and how often they search. A rate of 30% on one engine and 60% on another may reflect interface design more than your content.
- Ignoring empty source lists. Runs with no citations belong in the denominator. Dropping them overstates your rate.
Reporting guidance
When you publish citation numbers inside a team, state four things next to each figure: the engine, the collection method, the number of runs, and the definition used (runs-with-own-domain, not link counts). Without them, two reports with the same label can describe different quantities, and a change between periods may come from a changed rule and not from your content.
Exercise
A tracker reports 10 runs. In 4 runs, the answer cites acme.com. In one of those 4 runs it cites acme.com three times. In 2 other runs it cites blog.acme.com once each. In 3 runs it shows no sources at all. What are the citation rate and the any-citation rate for acme.com? Which counting mistakes would give a different citation rate?
Show answer
Runs citing the own domain are the 4 runs with acme.com plus the 2 runs with blog.acme.com, since subdomains count as own. That is 6 of 10, so the citation rate is 0.6. Runs with any citation are 10 minus the 3 without sources, so 7 of 10, and the any-citation rate is 0.7. Counting every link would give 3 + 3 + 2 = 8 own links, which is wrong because the repeated links in one run inflate the rate. Ignoring subdomains would give 0.4. Dropping the 3 runs with no sources from the denominator would give 6 of 7, about 0.86, which overstates the rate.