Skip to content

feat(topics): switch the Topics overview to prompt-level Visibility Rate - #499

Merged
gkhngyk merged 1 commit into
mainfrom
feature/topics-visibility-rate
Jul 21, 2026
Merged

gkhngyk merged 1 commit into
mainfrom
feature/topics-visibility-rate

Conversation

@gkhngyk

@gkhngyk gkhngyk commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Part of #493 — the Topics page must read on the same scale as the Insights headline. The overview's "Visibility (30d)" column previously averaged raw visibility scores across all results, which reads near zero for most brands (every answer without an appearance contributes 0). It now shows the #490 Visibility Rate: distinct prompts the brand appeared in ÷ distinct prompts that produced results, same "appeared" rule (≥1 mention or citation) and 30d window as Insights.

  • Leaderboard: the column keeps its "Visibility (30d)" header but renders the rate as a percentage; the cell tooltip shows "Appeared in X of Y prompts"; sorting follows the rate.
  • KPI cards: Best performer / Biggest gap show the rate; "Top mover (7d)" is now the rate difference in pts (current 7d − previous 7d), matching the Insights leaderboard's delta language — the trend column's inline delta uses pts too.
  • Sparkline: tracks the daily visible-answer share instead of the daily score average.
  • CSV export: avg_visibility_score → visibility_rate, plus new visible_prompts / active_prompts columns.
  • Aggregation stays a paged scan with the same feat(shopping): org-level "Shopping mode" toggle + ChatGPT Shopping platform + Insights isolation #155 shopping exclusion; the per-window prompt sets are collected in the same pass, so no extra queries.

Verified against production data: rates now spread meaningfully (e.g. 88.2% / 23.5% / 18.2% across topics) instead of clustering near zero.

The topic detail page reads from the Insights primitives via a separate action and still shows the score — that remains open under #493 (this PR does not close it).

Related issue

Part of #493

Type of change

  • feat — New feature

How to test

  1. Open /dashboard/topics for a brand with tracking history.
  2. The Visibility (30d) column shows percentages that match the Insights headline logic — hover a cell to see "Appeared in X of Y prompts", and X/Y ÷ should equal the shown rate.
  3. Rows sort by rate; Best performer / Biggest gap KPI values match the top/bottom non-zero rows.
  4. Top mover shows a ± N pts value when a topic has results in both 7d windows; the trend column's delta also reads in pts.
  5. Export CSV → visibility_rate, visible_prompts, active_prompts columns are present and consistent with the table.
  6. A topic with no results in the last 30 days shows an em dash.

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

Part of #493. The leaderboard's Visibility (30d) column, the Best
performer / Biggest gap / Top mover KPI cards, sorting and the CSV
export now use the #490 rate (distinct prompts the brand appeared in ÷
distinct prompts with results, same appeared rule as Insights) instead
of the raw score average that read near zero for most brands. The 7d
change is the rate difference in points, the sparkline tracks the daily
visible-answer share, the cell tooltip shows appeared-in X of Y prompts,
and the export gains visible_prompts / active_prompts columns.

The topic detail page still reads from the Insights primitives and
remains #493 scope.
@gkhngyk
gkhngyk merged commit 231f106 into main Jul 21, 2026
5 checks passed
@gkhngyk
gkhngyk deleted the feature/topics-visibility-rate branch July 21, 2026 19:02
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.

1 participant