feat(analytics): give account owners the traffic explorer - #483
Open
alukach wants to merge 3 commits into
Open
Conversation
The admin traffic explorer becomes a shared BreakdownExplorer: the admin page keeps every dimension, while an account-scoped tab pins its account via hidden scope filters and drops "account" from the filter/group-by chips so the query string can't widen the view. Reached through a PROFILE | ANALYTICS tab on the account profile, mirroring the product tab — the same ?tab=analytics middleware rewrite, now matching one-segment account roots too. Carries the product page's preview callout. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Claude finished @alukach's task in 3m 11s —— View job Reviewing PR #483
✅ No blocking issues — safe to merge. Went through the diff against
Nothing here blocks merge. Verification was limited to static review — this environment didn't permit running |
The account view titles itself with the account name, so the shared explorer no longer owns a heading. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
alukach
marked this pull request as ready for review
August 4, 2026 18:30
BreakdownExplorer forwarded breakdown.queries unconditionally, so the account view handed every owner and maintainer the Analytics Engine dataset name and blob1–blob9 layout. Gate it on an explicit showSql the caller opts into (admin page only) and withhold the prop entirely when closed — hiding the trigger would still ship the SQL to the client. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Repurposes the admin analytics portal for account owners/maintainers.
What changed
Shared view. The admin page's body moves to
BreakdownExplorer— same controls, chart, and ranked table. The admin page is now a gate plus one render call.Account scope. A new
/{account}/-/analyticsroute pins its account throughscopeFilters(applied to every query, absent from the UI and URLs) and passes every dimension exceptaccountas the offered filter/group-by set.parseStateonly accepts filters and group-bys for offered dimensions, so?account=someone-else&groupBy=accountcan't widen the view — pinned by a unit test.Reached as a tab.
PROFILE | ANALYTICSon the account profile, mirroring the product'sPRODUCT | ANALYTICS. Same?tab=analyticsmiddleware rewrite, whose match now covers one-segment account roots as well as two-segment product roots.ProductTabs.tsxbecomesTabs.tsxwithProductTabsandAccountTabsover one shared strip.Preview callout. The same blue notice the product analytics page shows.
Authorization is
canManageAccount(owners, maintainers, admins) — same 404 for everyone else, fromgenerateMetadataas well as the page body.Screen.Recording.2026-08-04.at.11.31.31.AM.mov
Notes
baseUrlinto a path (form action, link base) and params re-emitted as hidden inputs — that's what keepstab=analyticsalive across a filter submit.Verification
npx jest— 485 passed; the 3 failing suites (5 tests) fail identically onmain(recharts/RTL, untouched files).npm run type-check— no new errors; the pre-existingAdminBreakdownChart.tsx/panels.tsxerrors are unchanged and also blocknpm run buildonmain. Routing was verified with a one-off build that skipped type checking: compiled clean, no route conflict between[account_id]/-/and[account_id]/[product_id].🤖 Generated with Claude Code