Repository navigation
feat(insights): visibility rate as the headline metric across Insights - #490
Merged
Merged
Conversation
Averaging visibility over ALL results reads near zero for most brands — every answer the brand is absent from contributes a 0, and tracking many platforms dilutes each appearance further. That number buried the two facts users act on: how often the brand shows up, and how good it looks when it does. Competing tools headline exactly those two. The KPI row now leads with Visibility Rate (distinct prompts the brand appeared in / prompts that produced results, same filters as the row — the Tracked Prompts KPI is the denominator on purpose) with the quality split in its sub-line (avg score over only the answers the brand is in), and Share of Voice (already computed for the charts, now surfaced with its period delta). The raw average leaves the headline; it lives on in the rate's sub-line and the per-model breakdown sheet. New visible_prompt_stats RPC (00027) mirrors tracked_prompt_count's filters and shopping exclusion; applied to the hosted DB. sovData is no longer nulled when per-platform rows are empty — the chart section gates on byPlatform itself so the KPI card keeps overallSov.
Follow-up to the Visibility Rate headline: the Brand vs Competitors leaderboard still displayed the all-rows score average, which reads ~1% for a brand that appears in a third of its prompts and contradicted the new headline number sitting right above it. competitor_aggregates (00028, applied to the hosted DB) now also returns distinct-prompt counts: total prompts in the window plus per-entity prompts-appeared, for the brand and each competitor. The leaderboard ranks and displays visible_prompts / prompt_count with the same denominator for everyone (#478 rule kept — absence still costs), and its delta badge is the rate's point change vs the previous window. The score average stays in the payload for the per-provider chart. Also drops the Visibility Rate KPI card's sub-line per feedback — the percentage stands alone.
Replace each row's mentions · citations sub-line with the fraction behind the displayed rate (appeared in X/Y prompts) so the number and its explanation sit together. Entries carry the raw numerator and the shared denominator alongside the percentage.
Six cards made the KPI row cramped; SoV keeps its own chart section below with the same number and delta, so the headline card was redundant. sovData handling reverts to chart-gated.
Completes the rate switch: the Brand vs Competitors provider bars still plotted the all-rows score average, contradicting the leaderboard next to them. competitor_aggregates (00029, applied to the hosted DB) now carries distinct-prompt counts per (model_used, platform) group, and the provider fold divides everyone by the brand bucket's prompt count — the same-denominator rule at provider granularity. Summing DISTINCT counts across two engines of one provider counts a shared prompt once per engine in numerator and denominator alike, so the folded rate stays unbiased.
Bring the mentions · citations line back above the appeared-in fraction — dropping it lost the intensity signal that explains rate ties (many citations vs broad-but-shallow presence).
This was referenced Jul 20, 2026
Closed
Closed
Contributor
Author
|
Added a refetch overlay on top of the rate work: on a date/filter change the content dims under a small floating spinner instead of silently showing the previous window's numbers until the new payload lands. First load keeps the skeleton; the filter bar stays interactive during the reload. |
This was referenced Jul 20, 2026
gkhngyk
added a commit
that referenced
this pull request
Jul 21, 2026
…ate (#499) 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.
5 tasks done
gkhngyk
pushed a commit
that referenced
this pull request
Jul 22, 2026
…denominator (#491) (#502) Three changes, all additive: 1. getVisibilitySummaryFor — adds visiblePrompts, promptCount and visibilityRatePct to totals. Counts distinct prompt_ids from the same filtered prompt_results rows (chatgpt-shopping excluded). A prompt is 'visible' when mention_count > 0 OR citation_count > 0, matching the visible_prompt_stats RPC and the Insights KPI card. 2. getVisibilitySummaryFor — fixes topCompetitors[].avgVisibility to divide by the total result-row count (same denominator as the brand) instead of the competitor's own mention count. Prevents inflated scores for competitors that only appear in their best runs (#478). 3. getCompetitorComparisonFor — maps brand_prompt_count, brand_visible_prompts and by_competitor[].visible_prompts from the competitor_aggregates RPC (already present since #490) to new output fields: visibility_rate_pct, visible_prompts, prompt_count on both brand and every competitor. All rates share brand_prompt_count as the denominator so entries are directly comparable, matching the dashboard leaderboard. avg_visibility_score kept for backward compat. Updates MCP tool descriptions so an assistant knows visibilityRatePct / visibility_rate_pct is the headline and avgVisibility is the intensity score. yarn lint, yarn typecheck, yarn format:check all pass from web/.
6 tasks done
Merged
7 tasks done
This was referenced Jul 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Insights headline was the average visibility score over ALL results. Every answer the brand is absent from contributes a 0, and tracking many platforms dilutes each appearance further — so the number reads near zero for most brands and buries the fact users act on: how often the brand actually shows up. This PR switches the whole visibility narrative to one prompt-level metric, end to end:
mentions · citationsplus the fraction behind its percentage (appeared in X/Y prompts), and the delta badge is the rate's point change vs the previous window.Backend
Two additive RPC changes, both applied to the hosted DB:
visible_prompt_stats(00027) — distinct prompts appeared / visible result rows / their score sum, mirroringtracked_prompt_count's filters and the feat(shopping): org-level "Shopping mode" toggle + ChatGPT Shopping platform + Insights isolation #155 shopping exclusion.competitor_aggregates(00028 + 00029) — distinct-prompt counts overall and per (model_used, platform) group, for the brand and each competitor. Payload shape is additive; existing readers are unaffected. Summing DISTINCT counts across two engines of one provider counts a shared prompt once per engine in numerator and denominator alike, so folded rates stay unbiased.Related issue
Follow-up to #457 (Tracked Prompts KPI) and #478 (same-denominator leaderboard rule); metric direction discussed with the team.
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
/dashboard/insights— the first KPI card is Visibility Rate (a percentage), and the row has 5 cards; clicking the card opens the visibility breakdown sheet.N%, amentions · citationsline andappeared in X/Y promptswhere X/Y matches the displayed percentage; the brand's Y equals the Tracked Prompts KPI.Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)