Skip to content

feat(metrics): AI visibility score on MCP, public API, Looker, breakdown sheet and pulse movers - #575

Merged
gkhngyk merged 1 commit into
mainfrom
feature/ai-visibility-score-external
Aug 1, 2026
Merged

gkhngyk merged 1 commit into
mainfrom
feature/ai-visibility-score-external

Conversation

@gkhngyk

@gkhngyk gkhngyk commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Completes the score rollout on the external and remaining internal surfaces (#574 follow-up). All external changes are additive — old fields stay and are marked deprecated, so no existing integration breaks.

External surfaces:

  • MCP get_visibility_summary — totals.aiVisibilityScore (+ mentionAnswers / citationAnswers / positionFactor) and a score per top competitor; tool description rewritten so agents quote the score (without a % sign) and treat the old averages as legacy.
  • Public API v1 — /visibility-summary inherits the new totals; /competitor-comparison gains ai_visibility_score on the brand row and every competitor row; /visibility-trend gains a per-day ai_visibility_score (day granularity; null on week buckets). docs/api-reference/metrics.mdx documents the field and the deprecations.
  • Looker Studio connector — new "Visibility (AI Visibility Score)" metric on the Visibility Trend report, mapped from the new field; legacy metrics untouched.

Internal leftovers:

  • Insights breakdown sheet — clicking the Visibility KPI now drills into the SAME score: per-prompt/platform/topic groups compute the score from their own answers (components from the raw scan; no extra RPC), titled "Visibility" with pts deltas.
  • Daily Pulse movers — the "top prompt gains" highlight now picks movers by per-prompt score deltas (was: legacy average-score deltas). Backed by migration 00041: prompt_visibility_summaries gains an optional p_date_to (defaults to NULL — every existing caller unchanged). Already applied to the hosted database.

Related issue

—

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. GET /api/v1/visibility-summary?brand_id=… → totals.aiVisibilityScore matches the dashboard's Visibility for the same window; old fields still present.
  2. GET /api/v1/visibility-trend?granularity=day → buckets carry ai_visibility_score; granularity=week → null.
  3. Insights → click the Visibility KPI → the sheet's totals match the card and group rows show score points.
  4. node src/scripts/test-pulse.js <brandId> → prompt-gain highlights derive from score deltas.

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

@gkhngyk
gkhngyk merged commit 3e1f7d0 into main Aug 1, 2026
5 checks passed
@gkhngyk
gkhngyk deleted the feature/ai-visibility-score-external branch August 1, 2026 11:43
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