MCPcopy Index your code
hub / github.com/21st-dev/1code / capture

Function capture

src/main/lib/analytics.ts:135–157  ·  view source on GitHub ↗
(
  eventName: string,
  properties?: Record<string, any>,
)

Source from the content-addressed store, hash-verified

133 * Capture an analytics event
134 */
135export function capture(
136 eventName: string,
137 properties?: Record<string, any>,
138) {
139 // Skip in development mode
140 if (isDev()) return
141
142 // Skip if user opted out
143 if (userOptedOut) return
144
145 if (!posthog) return
146
147 const distinctId = currentUserId || "anonymous"
148
149 posthog.capture({
150 distinctId,
151 event: eventName,
152 properties: {
153 ...getCommonProperties(),
154 ...properties,
155 },
156 })
157}
158
159/**
160 * Identify a user

Callers 10

trackAppOpenedFunction · 0.70
trackAuthCompletedFunction · 0.70
trackProjectOpenedFunction · 0.70
trackWorkspaceCreatedFunction · 0.70
trackWorkspaceArchivedFunction · 0.70
trackWorkspaceDeletedFunction · 0.70
trackMessageSentFunction · 0.70
trackPRCreatedFunction · 0.70
trackCommitCreatedFunction · 0.70
trackSubChatCreatedFunction · 0.70

Calls 2

isDevFunction · 0.70
getCommonPropertiesFunction · 0.70

Tested by

no test coverage detected