Overhaul Analytics page: heatmap + distinct user vs business views #94

Closed
opened 2026-08-02 04:37:28 -07:00 by westfarn · 0 comments
Owner

Context

Current /analytics/ shows basic bar charts (prompt usage, conversation usage, optional company usage for managers, admin response times). Needs a real product overhaul.

Heatmap: Discussed previously (weekday × hour prompt-frequency grid, Cursor-style). No dedicated ticket existed. Partial WIP was started toward Account settings (PromptHeatmapCard + GET /analytics/user_prompt_heatmap/) but was not shipped / not in repo. This ticket owns placing that heatmap on the Analytics page (preferred home), not buried only in Account.

Related old ticket (different chart): #2 scatter plot — out of scope unless we explicitly fold it in.

Companion BE work may be needed for heatmap + any new aggregates (create BE follow-ups if APIs missing).

Goal

Make Analytics useful for individual users and business/company managers, with clear separation of what each audience sees.


Individual user (all entitled users)

Show the user’s own usage patterns:

  1. Prompt activity heatmap — Y = day of week (Mon–Sun), X = hour bins (0–23), cell intensity = count of user-entered prompts in local timezone. Footer: most active day/hour, peak cell, total.
  2. Volume over time — prompts and/or conversations per day/week (keep/improve existing charts; clearer labels, date range if feasible).
  3. Optional later: token/prompt quota context (link to Account plan/usage rather than duplicating billing UI).

Do not show other users’ identifiable activity to a normal member.


Business / company manager

In addition to (or clearly sectioned from) personal view:

  1. Company usage overview — seat / account usage trends (evolve current company usage card).
  2. Team activity (aggregated) — e.g. active users over time, total prompts/conversations for the company — no private message content.
  3. Optional heatmap modes — personal heatmap always; company-level heatmap only if we can aggregate safely (company-wide prompt timing), never per-user heatmap that exposes individuals unless product explicitly wants anonymized rollups.
  4. Keep admin-only response-time / ops charts gated (current hard-coded admin email should become a proper role check when touched).

UX notes

  • One composition / clear sections: e.g. “Your activity” vs “Company” (tabs or stacked sections).
  • Heatmap is a primary visual for personal activity — not an afterthought.
  • Mobile-friendly; match existing glass card / theme patterns.

Acceptance

  • Analytics page redesigned with clear You vs Company (company section only for managers / business)
  • Weekday × hour prompt heatmap shipped for the signed-in user (local TZ)
  • Existing useful charts retained or replaced with better equivalents (not a regression to empty page)
  • No cross-user PII leakage in member view
  • Admin/ops charts remain restricted
  • FE tests for role-based section visibility + heatmap empty/loading states

Out of scope (unless pulled in)

  • Tianji product analytics / marketing funnel
  • Replacing Account “Plan & usage” billing card
## Context Current `/analytics/` shows basic bar charts (prompt usage, conversation usage, optional company usage for managers, admin response times). Needs a real product overhaul. **Heatmap:** Discussed previously (weekday × hour prompt-frequency grid, Cursor-style). **No dedicated ticket existed.** Partial WIP was started toward Account settings (`PromptHeatmapCard` + `GET /analytics/user_prompt_heatmap/`) but was **not shipped / not in repo**. This ticket owns placing that heatmap on the **Analytics** page (preferred home), not buried only in Account. Related old ticket (different chart): [#2](https://git.aimloperations.com/ai_ml_operations/chat_web_app/issues/2) scatter plot — out of scope unless we explicitly fold it in. Companion BE work may be needed for heatmap + any new aggregates (create BE follow-ups if APIs missing). ## Goal Make Analytics useful for **individual users** and **business/company managers**, with clear separation of what each audience sees. --- ## Individual user (all entitled users) Show the user’s own usage patterns: 1. **Prompt activity heatmap** — Y = day of week (Mon–Sun), X = hour bins (0–23), cell intensity = count of **user-entered** prompts in local timezone. Footer: most active day/hour, peak cell, total. 2. **Volume over time** — prompts and/or conversations per day/week (keep/improve existing charts; clearer labels, date range if feasible). 3. **Optional later:** token/prompt quota context (link to Account plan/usage rather than duplicating billing UI). Do **not** show other users’ identifiable activity to a normal member. --- ## Business / company manager In addition to (or clearly sectioned from) personal view: 1. **Company usage overview** — seat / account usage trends (evolve current company usage card). 2. **Team activity (aggregated)** — e.g. active users over time, total prompts/conversations for the company — **no** private message content. 3. **Optional heatmap modes** — personal heatmap always; company-level heatmap only if we can aggregate safely (company-wide prompt timing), never per-user heatmap that exposes individuals unless product explicitly wants anonymized rollups. 4. Keep admin-only response-time / ops charts gated (current hard-coded admin email should become a proper role check when touched). --- ## UX notes - One composition / clear sections: e.g. “Your activity” vs “Company” (tabs or stacked sections). - Heatmap is a primary visual for personal activity — not an afterthought. - Mobile-friendly; match existing glass card / theme patterns. ## Acceptance - [ ] Analytics page redesigned with clear **You** vs **Company** (company section only for managers / business) - [ ] Weekday × hour prompt heatmap shipped for the signed-in user (local TZ) - [ ] Existing useful charts retained or replaced with better equivalents (not a regression to empty page) - [ ] No cross-user PII leakage in member view - [ ] Admin/ops charts remain restricted - [ ] FE tests for role-based section visibility + heatmap empty/loading states ## Out of scope (unless pulled in) - Tianji product analytics / marketing funnel - Replacing Account “Plan & usage” billing card
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ai_ml_operations/chat_web_app#94