Skip to content

Add session_name to Ask AI PostHog events - #1547

Draft
samseely wants to merge 1 commit into
mainfrom
cursor/add-session-name-posthog-133f
Draft

Add session_name to Ask AI PostHog events#1547
samseely wants to merge 1 commit into
mainfrom
cursor/add-session-name-posthog-133f

Conversation

@samseely

Copy link
Copy Markdown
Contributor

Summary

Adds the session_name property to all Ask AI PostHog events to enable tracking which chat session users are interacting with.

Changes

Updated the following PostHog events to include session_name:

Event File Notes
ask-ai-sidebar-opened-client AskAiContext.tsx Current session title, or "New chat" for new sessions
ask-ai-sidebar-closed-client AskAiContext.tsx Current session title
ask-ai-session-switched-client AskAiContext.tsx Target session's title
ask-ai-message-sent-client useChatStream.ts Current session title, or "New chat" for new sessions
ask-ai-stream-stopped-client useChatStream.ts Current session title

For new sessions, session_name is "New chat" until a title is generated after the first assistant response.

Implementation details

  • Added a getCurrentSessionTitle() helper in both files to look up the session title from chatSessions using currentChatId
  • For events fired during new session creation (like openSidebarWithPrompt), the session_name is explicitly set to "New chat" since the session is created before tracking
  • The mobile modal events (ask-ai-mobile-modal-opened-client) were not updated because they use Inkeep's external chat widget which has its own session management separate from our custom chat system

Testing

  • TypeScript type checking passes
  • ESLint passes

Resolves KNO-14289

Linear Issue: KNO-14289

Open in Web Open in Cursor 

Adds the session_name property to all Ask AI PostHog events to enable
tracking which chat session users are interacting with:

- ask-ai-sidebar-opened-client: Added session_name from current session
- ask-ai-sidebar-closed-client: Added session_name from current session
- ask-ai-session-switched-client: Added session_name from target session
- ask-ai-message-sent-client: Added session_name from current session
- ask-ai-stream-stopped-client: Added session_name from current session

For new sessions, session_name is 'New chat' until a title is generated.

Resolves KNO-14289

Co-authored-by: Sam Seely <samseely@gmail.com>
@linear-code

linear-code Bot commented Jul 17, 2026

Copy link
Copy Markdown

KNO-14289

@vercel

vercel Bot commented Jul 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Jul 17, 2026 6:33pm

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants