feat(analytics): add OneDollarStats custom events - #487
Merged
Conversation
Track key user interactions: - Model switched (with model ID) - Message sent (with model ID) - Chat created - Signed in (after OAuth) - Thinking mode changed (with effort level) - Search toggled (enabled/disabled)
|
🚅 Deployed to the openchat-pr-487 environment in OpenChat
|
Contributor
🚀 Preview Deployment Ready
Convex Preview Backend
🤖 Deployed automatically by GitHub Actions |
Contributor
Greptile SummaryThis PR adds OneDollarStats custom event tracking for key user interactions. A new analytics utility module ( Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
actor User
participant UI as UI/Components
participant Store as Zustand Store
participant Analytics as analytics.ts
participant Window as window.stonks
User->>UI: Switch Model
UI->>Store: setSelectedModel(modelId)
Store->>Analytics: analytics.modelSwitched(modelId)
Analytics->>Window: window.stonks.event("Model Switched", {model})
User->>UI: Change Reasoning Effort
UI->>Store: setReasoningEffort(effort)
Store->>Analytics: analytics.thinkingModeChanged(effort)
Analytics->>Window: window.stonks.event("Thinking Mode Changed", {effort})
User->>UI: Toggle Web Search
UI->>Store: toggleWebSearch() or setWebSearchEnabled(enabled)
Store->>Analytics: analytics.searchToggled(enabled)
Analytics->>Window: window.stonks.event("Search Toggled", {enabled})
User->>UI: Create New Chat & Send Message
UI->>Store: createChat()
Store->>Analytics: analytics.chatCreated()
Analytics->>Window: window.stonks.event("Chat Created")
UI->>Store: sendMessage(text)
Store->>Analytics: analytics.messageSent(modelId)
Analytics->>Window: window.stonks.event("Message Sent", {model})
User->>UI: Sign In with GitHub
UI->>AuthClient: verify one-time token
AuthClient->>Analytics: analytics.signedIn()
Analytics->>Window: window.stonks.event("Signed In")
|
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.
Summary
Adds OneDollarStats custom event tracking for key user interactions.
Events Tracked
model(model ID)model(model ID)effort(none/low/medium/high)enabled(true/false)Changes
apps/web/src/lib/analytics.ts- utility wrapper for OneDollarStats eventsstores/model.ts- model switch, thinking modestores/provider.ts- search togglehooks/use-persistent-chat.ts- message sent, chat createdlib/auth-client.tsx- sign inTesting