Skip to content

Commit 0433e52

Browse files
committed
fix(analytics): omit empty workspace_id/workflow_id on copilot_chat_sent
Final-sweep nit: copilot_chat_sent sent '' for workspace_id/workflow_id in the agent (workspace-less) branch, same phantom-bucket issue as file_downloaded. Make both properties optional and omit them when absent.
1 parent 470edf7 commit 0433e52

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

apps/sim/lib/copilot/chat/post.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,8 +1081,8 @@ export async function handleUnifiedChatPost(req: NextRequest) {
10811081
authenticatedUserId,
10821082
'copilot_chat_sent',
10831083
{
1084-
workflow_id: branch.kind === 'workflow' ? branch.workflowId : '',
1085-
workspace_id: workspaceId ?? '',
1084+
...(branch.kind === 'workflow' ? { workflow_id: branch.workflowId } : {}),
1085+
...(workspaceId ? { workspace_id: workspaceId } : {}),
10861086
has_file_attachments: (body.fileAttachments?.length ?? 0) > 0,
10871087
has_contexts: normalizedContexts.length > 0,
10881088
mode: branch.kind === 'workflow' ? branch.mode : 'agent',

apps/sim/lib/posthog/events.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,8 +360,8 @@ export interface PostHogEventMap {
360360
}
361361

362362
copilot_chat_sent: {
363-
workflow_id: string
364-
workspace_id: string
363+
workflow_id?: string
364+
workspace_id?: string
365365
has_file_attachments: boolean
366366
has_contexts: boolean
367367
mode: string

0 commit comments

Comments
 (0)