aboutsummaryrefslogtreecommitdiff
path: root/apps/web/lib/analytics.ts
blob: 428ac872d99360e6cc0cbe4272c00ccdf795b2f2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import posthog from "posthog-js"

export const analytics = {
	userSignedOut: () => posthog.capture("user_signed_out"),

	memoryAdded: (props: {
		type: "note" | "link" | "file"
		project_id?: string
		content_length?: number
		file_size?: number
		file_type?: string
	}) => posthog.capture("memory_added", props),

	memoryDetailOpened: () => posthog.capture("memory_detail_opened"),

	projectCreated: () => posthog.capture("project_created"),

	newChatStarted: () => posthog.capture("new_chat_started"),
	chatHistoryViewed: () => posthog.capture("chat_history_viewed"),
	chatDeleted: () => posthog.capture("chat_deleted"),

	viewModeChanged: (mode: "graph" | "list") =>
		posthog.capture("view_mode_changed", { mode }),

	documentCardClicked: () => posthog.capture("document_card_clicked"),

	billingViewed: () => posthog.capture("billing_viewed"),
	upgradeInitiated: () => posthog.capture("upgrade_initiated"),
	upgradeCompleted: () => posthog.capture("upgrade_completed"),
	billingPortalOpened: () => posthog.capture("billing_portal_opened"),

	connectionAdded: (provider: string) =>
		posthog.capture("connection_added", { provider }),
	connectionDeleted: () => posthog.capture("connection_deleted"),
	connectionAuthStarted: () => posthog.capture("connection_auth_started"),
	connectionAuthCompleted: () => posthog.capture("connection_auth_completed"),
	connectionAuthFailed: () => posthog.capture("connection_auth_failed"),

	mcpViewOpened: () => posthog.capture("mcp_view_opened"),
	mcpInstallCmdCopied: () => posthog.capture("mcp_install_cmd_copied"),

	extensionInstallClicked: () => posthog.capture("extension_install_clicked"),
}