Files
chat_web_app/llm-fe/ANALYTICS.md
T
westfarn 3858b97104
Deploy Beta / unit-tests (push) Successful in 11s
Unit Tests / test (push) Successful in 12s
Deploy Beta / deploy-beta (push) Failing after 2m10s
Message actions + citation Sources (#97, #98) (#101)
## Summary
- Closes [#97](#97) — message action row: copy (raw markdown + code-block copy), thumbs up/down with optimistic updates + down-reason popover, and export menu (PDF / DOCX / CSV / XLSX / TXT) for a single message plus conversation-level export in the chat toolbar.
- Closes [#98](#98) — versioned WS `citations` frame parsing, Sources list under assistant bubbles, clickable `[n]` markers, and history hydrate from `Prompt.citations`.
- Backend companion for ratings: [chat_backend#67](ai_ml_operations/chat_backend#67). Thumbs UI posts to `prompt_feedback` once that lands; votes rehydrate from `conversation_details.feedback`.
- Export libs (`pdfmake`, `docx`, `papaparse`, `xlsx`) are dynamically imported so they stay out of the main path until used.

## Test plan
- [ ] Stream a grounded answer → Sources appear after stream; inline `[n]` highlights the matching source; reload keeps Sources.
- [ ] Non-grounded turn → no Sources header.
- [ ] Copy message + code block; confirm checkmark ~2s; failure path shows toast.
- [ ] Thumbs up/down optimistic UI; clear by re-click; down opens reason popover without blocking the vote (needs chat_backend#67).
- [ ] Export one message and whole conversation in all five formats; check searchable PDF text and DOCX structure.
- [ ] Action row: hover reveal on desktop, always visible on last/touch; hidden while streaming.
- [ ] `npm test -- --testPathPattern='wsFrames|clipboard|exportChat|promptFeedback|ConversationDetailCard'`Reviewed-on: #101
2026-08-04 03:32:17 -07:00

2.6 KiB

Tianji product events (Hesychia)

Helpers: llm-fe/src/llm-fe/utils/analytics.ts
Consent gate: custom events + identify only when hesychia_analytics_consent* is granted (see #37).
Page views: always via Tracker / tracker.js on prod + beta.

Event catalog

Event name Constant Call site(s) Payload (non-PII)
Login Success LOGIN_SUCCESS SignIn, AuthCallback { method: 'password' | 'sso' }
Login Failed LOGIN_FAILED SignIn, AuthCallback { method }
Sign Up Started SIGNUP_STARTED SignUp
Sign Up Success SIGNUP_SUCCESS SignUp, AuthCallback (created) { method? }
Sign Up Failed SIGNUP_FAILED SignUp, AuthCallback { method? }
Logout LOGOUT AnalyticsSession (auth → logged out)
Checkout Started CHECKOUT_STARTED SignUp, AuthCallback { source }
Payment Success PAYMENT_SUCCESS BillingSuccess { hasSessionId }
Payment Canceled PAYMENT_CANCELED BillingCancel
Conversation Created CONVERSATION_CREATED MessageContext { conversationId }
Message Sent MESSAGE_SENT AsyncDashboard2 { hasConversation, hasAttachment }
ToS Acknowledged TOS_ACKNOWLEDGED TermsOfService
Billing Portal Opened BILLING_PORTAL_OPENED BillingSection (Account) { intent? }
Subscription Upgrade Started SUBSCRIPTION_UPGRADE_STARTED BillingSection, UsageSummaryCard { source, plan_slug? }
Plan Change Started PLAN_CHANGE_STARTED BillingSection { source, plan_slug? }
Subscription Cancel Started SUBSCRIPTION_CANCEL_STARTED BillingSection { source: 'portal' }
Account Delete Started ACCOUNT_DELETE_STARTED DeleteAccountSection
Account Delete Success ACCOUNT_DELETE_SUCCESS DeleteAccountSection
Account Delete Failed ACCOUNT_DELETE_FAILED DeleteAccountSection
Message Copied MESSAGE_COPIED MessageActions { role }
Message Rated MESSAGE_RATED MessageActions { rating: 'up' | 'down' | 'cleared' }
Message Rating Reason MESSAGE_RATING_REASON MessageActions { reason, hasComment }
Message Exported MESSAGE_EXPORTED MessageActions, AsyncDashboard2 { format, scope }

Identify

identifyAccount(account) sends { userId: email, companyId?, isCompanyManager? }.
No message text, document contents, or names.

Environments

Only prod/beta (REACT_APP_DEPLOY_ENV or production build with Tianji website id). Local dev skips unless env set.