Skip to content

Commit 1606ef1

Browse files
brendan-kellamcursoragentgithub-actions[bot]
authored
chore(web): Add selectedReposCount property to wa_chat_message_sent posthog event (#941)
* feat: add selectedReposCount to wa_chat_message_sent event - Add selectedReposCount field to wa_chat_message_sent event type - Include selectedReposCount in chat message events for both streaming and blocking endpoints - This provides analytics on how many repositories users select when asking questions Co-authored-by: Brendan Kellam <brendan@sourcebot.dev> * chore: add changelog entry for selectedReposCount in wa_chat_message_sent Co-authored-by: Brendan Kellam <brendan-kellam@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Brendan Kellam <brendan-kellam@users.noreply.github.com>
1 parent 38b5479 commit 1606ef1

File tree

4 files changed

+5
-2
lines changed

4 files changed

+5
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
- Added `wa_user_created` PostHog event fired on successful user sign-up. [#933](https://github.com/sourcebot-dev/sourcebot/pull/933)
1515
- Added `wa_askgh_login_wall_prompted` PostHog event fired when an unauthenticated user attempts to ask a question on Ask GitHub. [#933](https://github.com/sourcebot-dev/sourcebot/pull/933)
1616
- Added Bitbucket Server (Data Center) OAuth 2.0 SSO identity provider support (`provider: "bitbucket-server"`). [#934](https://github.com/sourcebot-dev/sourcebot/pull/934)
17-
- Added Bitbucket Server (Data Center) sync all repositories support. [#927](https://github.com/sourcebot-dev/sourcebot/pull/927)
18-
- Added permission syncing support for Bitbucket Server (Data Center), including account-driven and repo-driven sync. [#938](https://github.com/sourcebot-dev/sourcebot/pull/938)
17+
- Added `selectedReposCount` to the `wa_chat_message_sent` PostHog event to track the number of selected repositories when users ask questions. [#941](https://github.com/sourcebot-dev/sourcebot/pull/941)
18+
1919

2020
### Changed
2121
- Hide version upgrade toast for askgithub deployment (`EXPERIMENT_ASK_GH_ENABLED`). [#931](https://github.com/sourcebot-dev/sourcebot/pull/931)

packages/web/src/app/api/(server)/chat/blocking/route.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ export const POST = apiHandler(async (request: NextRequest) => {
164164
await captureEvent('wa_chat_message_sent', {
165165
chatId: chat.id,
166166
messageCount: 1,
167+
selectedReposCount: selectedRepos.length,
167168
...(env.EXPERIMENT_ASK_GH_ENABLED === 'true' ? {
168169
selectedRepos: selectedRepos.map(r => r.value)
169170
} : {}),

packages/web/src/app/api/(server)/chat/route.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ export const POST = apiHandler(async (req: NextRequest) => {
103103
await captureEvent('wa_chat_message_sent', {
104104
chatId: id,
105105
messageCount: messages.length,
106+
selectedReposCount: expandedRepos.length,
106107
...(env.EXPERIMENT_ASK_GH_ENABLED === 'true' ? { selectedRepos: expandedRepos } : {}),
107108
} );
108109

packages/web/src/lib/posthogEvents.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ export type PosthogEventMap = {
157157
wa_chat_message_sent: {
158158
chatId: string,
159159
messageCount: number,
160+
selectedReposCount: number,
160161
/**
161162
* @note this field will only be populated when
162163
* the EXPERIMENT_ASK_GH_ENABLED environment variable

0 commit comments

Comments
 (0)