Repository navigation
Description
Summary
Add a Competitor Gaps view to the Citations page that surfaces the third-party domains AI engines use as sources around competitors but never around us — and, per competitor, which domains feed their visibility. This turns raw citation data into an actionable outreach/competitive-intel layer.
Who this is for / the need
- A growth/PR-minded user wants to see domains that cite competitors but not us, so they can build a concrete outreach list of publications to get featured in.
- A user wants to see, for each competitor, which domains feed them, so they can reverse-engineer where a competitor's AI visibility comes from.
Both are domain-granularity questions — the unit of action is a publication/domain, not a sentence — so this can be answered well without sentence-level citation attribution (see Non-goals).
Approach — response-level weighted co-occurrence (read-time, no new writes)
Every prompt_results row already carries, for a single AI answer:
citations— the source URLs cited in that answercompetitor_mentions— which competitors were named (withcompetitor_id/domain)mention_count/visibility_score— whether we were present
So the relationship we need is co-occurrence within one answer. For each answer:
- Collect the set of cited domains.
- Determine: were any competitors mentioned? were we present (our brand mentioned OR one of our
brand_domainscited)? - Aggregate per domain across the date range.
Gap domain = a third-party domain that appears in answers where a competitor is present and we are absent, and does not appear in any answer where we are present.
To keep it precise despite answers having many sources, weight each co-occurrence by 1 / (number of citations in that answer) so a focused 2-source answer counts more than a 20-source, multi-brand answer. Apply a small threshold (domain must appear in ≥N distinct competitor answers) to cut noise.
This is the same query shape and cost as the existing getCitationsOverview — no LLM/scraper/external API calls, no changes to the daily tracking pipeline. Select only citations, competitor_mentions, mention_count/visibility_score (not the large response text) and scope to a date window so it stays well under a second for typical brands.
UX
A new Competitor Gaps tab on /dashboard/citations, next to Domains / URLs, reusing the existing filter bar (date / platform / region / topic). Inside, a segmented control with two views:
View 1 — Gap list (outreach list)
Domains that cite ≥1 competitor but never cite/mention us.
| Domain | Source type | Competitor answers | Which competitors | Strength |
|---|---|---|---|---|
| caranddriver.com | review | 18 | Mercedes, BMW, Audi | ▇▇▇▇▇ ↗ |
| forum.xyz | forum | 12 | Mercedes, BMW | ▇▇▇ ↗ |
- Sorted by weighted competitor co-occurrence (the weighting math is hidden; surfaced as a "Strength" bar).
- "Which competitors" shows the top few as chips. ↗ opens the domain in a new tab.
View 2 — By competitor (source map)
A competitor selector; for the chosen competitor, the domains that feed them.
| Domain | Source type | Answers feeding competitor | Also cites us? | Strength |
|---|---|---|---|---|
| caranddriver.com | review | 18 | ✗ No | ▇▇▇▇▇ |
| autonews.com | news | 14 | ✓ Yes | ▇▇▇ |
- "Also cites us?" badge distinguishes exclusive vs overlapping sources — key for reverse-engineering.
- Wording is deliberately "associated with / feeds" rather than "exclusively feeds," since a multi-competitor answer credits a domain to more than one competitor.
Shared details
- Low-visibility empty/weak state: if we're present in almost no answers, the gap list inflates. Show a notice: "Your visibility is low, so this list may be broad — focus on baseline visibility first."
- Methodology tooltip: "Sources that appear in answers mentioning competitors but not you, weighted by how many sources each answer had."
- Row click can later open a drill-down of which answers cite the domain if/when that detail sheet exists; this feature does not depend on it.
Non-goals
- Sentence/span-level attribution (matching a specific
[1][2]marker to the exact competitor name it sits next to). The stored citationstartIndex/endIndexare real only for some API providers and are placeholders for all web-scraped platforms, so reliable span-level matching isn't possible today. It's also unnecessary here: both needs act on domains, not sentences.
Files to touch
web/src/lib/actions/citations.ts(or a newcitation-gaps.ts) — server action computing the weighted co-occurrence gap + per-competitor breakdown fromprompt_results+competitors+brand_domains.web/src/app/[locale]/(dashboard)/dashboard/citations/page.tsx— new "Competitor Gaps" tab with the Gap list / By competitor segmented control.
How to test
- For a brand with tracked competitors (with domains) and citation history, open Citations → Competitor Gaps → Gap list: only domains that cite a competitor and never cite/mention the brand appear, ranked by strength.
- A domain that cites both the brand and a competitor does not appear in the gap list.
- By competitor → pick a competitor: shows domains feeding that competitor, with a correct "Also cites us?" badge.
- A 20-source multi-brand answer contributes less per-domain strength than a focused 2-source answer (weighting works).
- No server action fires against any AI provider/scraper; load time is comparable to the existing Domains/URLs tabs.
- Low-visibility brand shows the explanatory notice instead of a misleadingly huge list.
Activity