Skip to content

feat(reports): mention & citation evidence sections + Brand Citations naming - #444

Merged
gkhngyk merged 1 commit into
mainfrom
feature/report-evidence
Jul 16, 2026
Merged

gkhngyk merged 1 commit into
mainfrom
feature/report-evidence

Conversation

@gkhngyk

@gkhngyk gkhngyk commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Reports currently show aggregate numbers (mentions, citations) with no way to see what's behind them, and the "Citations" KPI is easily confused with the Citations page total (it only counts citations to the brand's own domains, excluding chatgpt-shopping). This PR adds two pickable evidence sections and clarifies the metric naming:

  • Mention Evidence — top 10 prompt results by mention count within the report range: prompt text, platform, date, mention count, and a short excerpt showing how the brand was mentioned (first brand occurrence, word-bounded, markdown stripped). Rendered on the report detail page and in the PDF.
  • Citation Evidence — top 10 most-cited URLs within the report range: linked URL, domain, total citations, and up to 3 prompts that sourced it. URL normalization matches the Citations page (query/hash stripped, trailing slash trimmed); scans are paginated past the 1000-row cap with a 50k ceiling.
  • "Citations" KPI renamed to "Brand Citations" with a footnote (report page + PDF) explaining it counts citations to the brand's own domains and excludes ChatGPT Shopping — the root of the "why doesn't this match the Citations page" confusion.

Both sections are part of the executive_summary template by default; citation_sources includes Citation Evidence. Snapshots stay immutable: existing reports have no evidence fields and simply don't render the new sections.

Related issue

Closes #429

Type of change

  • feat — New feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

How to test

  1. Open Reports and generate an Executive Summary report for a brand with tracking data (both evidence sections are pre-selected in the dialog; they can be toggled off).
  2. On the report detail page, verify the Mention Evidence card (after Prompt Performance) lists prompts with platform, date, mention count and a readable excerpt.
  3. Verify the Citation Evidence card (after Citation Sources) lists linked URLs with citation counts and the prompts that cited them.
  4. Check the KPI grid: the card reads Brand Citations and a footnote explains the own-domain scope.
  5. Download the PDF and confirm both tables plus the KPI footnote render there too.
  6. Open a report generated before this change — no evidence sections, no errors.

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

… naming

Closes #429. A report reader asking 'which answers mentioned me, and
which URLs are these citations?' can now answer it inside the report —
including the forwarded PDF:

- Mention Evidence: the top 10 mentioning answers in the window, each
  with its prompt, platform, date and the passage of the answer around
  the brand mention (markdown-stripped, word-bounded excerpt; falls
  back to the answer's opening when the mention came via a domain).
  Server-side ORDER BY mention_count + LIMIT — no scan.
- Citation Evidence: the top 10 cited URLs with citation counts and up
  to 3 tracked prompts whose answers cited each. Own paginated scan
  (1000-row pages, 50k ceiling) because the citations overview doesn't
  keep prompt attribution; URL normalization matches the Citations
  page so the lists line up.
- Both are pickable sections following the payload-presence pattern:
  registered in the template registry (executive_summary gets both,
  citation_sources gains citationEvidence), gathered only when picked,
  rendered as cards on the detail page and as tables in the PDF. Old
  reports without the fields render unchanged.
- Naming: the KPI is now 'Brand Citations' with a one-line footnote
  (web + PDF), the citations section header notes it covers ALL cited
  sources, and the domains table no longer borrows the KPI label.

Deliberately out: KPI drill-down links into Insights/Citations — those
pages don't support date-prefilter URLs yet; noted as follow-up.
@gkhngyk
gkhngyk merged commit 3db8c2c into main Jul 16, 2026
5 checks passed
@gkhngyk
gkhngyk deleted the feature/report-evidence branch July 16, 2026 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reports: evidence drill-down for mention/citation KPIs and clearer metric naming

1 participant