Dashboard metrics are scoped to the active assistant or organization context. When no context is selected, the signed-in user’s default context is used.
Live Dashboard Workflow
Use the analytics dashboard to answer operational questions during and after support coverage.
| Dashboard area | What it shows | Operator or manager use |
|---|---|---|
| Timeframe selector | Last month or All time in the current UI. API clients can also request day, week, month, previous month, all time, or custom ranges. | Switch between recent operations review and long-term baseline checks. |
| Refresh action | Re-fetches analytics and sentiment payloads without changing the selected tab. | Refresh during active queue reviews or after a campaign, incident, or handoff spike. |
| KPI cards | Total conversations, total messages, average response time, and user rating. | Spot volume changes, response-time regressions, or rating movement before opening detailed tabs. |
| Tabs | Overview, sources, performance, engagement, and sentiment. | Move from broad activity to the operational surface that explains the change. |
| Charts and insight cards | Trends, source mix, response buckets, hourly engagement, topic lists, category lists, and sentiment distribution. | Identify staffing needs, content gaps, handoff causes, and customer friction patterns. |
Date Ranges
The analytics dashboard reads from /api/analytics and supports these ranges:
| Range | Calculation |
|---|---|
| Today | From local midnight today through the request time. |
| Last 7 days | Rolling seven-day window ending at the request time. |
| Last 30 days | Rolling one-month window ending at the request time. |
| Previous month | Previous calendar month, from day 1 at 00:00 through the final day at 23:59:59.999. |
| All time | Every conversation created before the request time. |
| Custom | Inclusive startDate through endDate query parameters. |
The current authenticated dashboard exposes Last month and All time controls. The analytics API accepts the wider range set documented above, so exported reports or internal tooling may show additional ranges.
Primary Metrics
| Metric | Dashboard label | Definition |
|---|---|---|
| Active conversations | Total conversations | Count of conversations documents for the selected context and date range. A conversation is included by its createdAt timestamp. |
| Total messages | Total messages | Sum of metadata.totalMessages when present; otherwise the count of items in the conversation messages array. |
| Average messages per conversation | Avg. messages / conversation | totalMessages / totalConversations, rounded to one decimal. Empty ranges return 0. |
| Active users | Active users | Count of unique non-empty endUserId values across matching conversations. |
| Average response time | Avg. response time | Average seconds between a user message and the immediately following assistant message. Only positive deltas below 600 seconds are included; dormant-session outliers are excluded. The result is rounded to one decimal. |
| Satisfaction | Satisfaction / average rating | Conversation-level metadata.analytics.rating average for new web-widget CSAT submissions. Backward-compatible aggregates may also read legacy metadata.rating, messages[].metadata.rating, and messages[].rating; count at most one rating per conversation. Ratings must be 1–5 integers and are rounded to one decimal. Sentiment satisfaction is documented separately on the Sentiment page. |
Response Time Buckets
The performance tab groups the same response-time samples into:
| Bucket | Definition |
|---|---|
| Fast | Less than 7.5 seconds. |
| Medium | 7.5 through 15 seconds. |
| Slow | More than 15 seconds and less than the 600-second outlier cap. |
Source Usage
Source usage is calculated per assistant message so the chart percentages add up cleanly:
| Slice | Definition |
|---|---|
| FAQ Sources | Assistant messages with at least one RAG match whose source contains faq. |
| Document Sources | Assistant messages with matches, but no FAQ match. |
| Direct Responses | Assistant messages with no RAG matches. |
The dashboard also tracks raw FAQ and document match counts for source coverage KPIs. These raw counts can exceed the number of assistant messages because one answer may cite multiple matches.
Trends And Topics
Conversation trends group matching conversations by createdAt day and return daily conversation and message counts.
Popular topics are extracted from user messages with a lightweight RAKE-style pass:
- Lowercase and strip punctuation and accents.
- Split around sentence boundaries, stop words, short tokens, and numbers.
- Keep one-to-five-word content phrases.
- Stem simple English and Italian variants.
- Merge near-duplicates by token subset or strong overlap.
The API returns up to 50 topics ordered by count. Topic trend is currently reported as stable.
Known Limits
Hourly engagement returns all 24 hourly slots. messages is the true per-hour message count; users is a placeholder that is 1 when that hour has activity and 0 otherwise.
Analytics are conversation-derived. Older event-based fields in backend/lib/analytics.ts are not the source for the current dashboard.
Real-time counters are available through /api/analytics/real-time for live dashboard surfaces, but the primary dashboard trends are still computed from persisted conversations. Use real-time views for queue awareness and persisted dashboard metrics for reporting.