MCPcopy
hub / github.com/21st-dev/1code / initAnalytics

Function initAnalytics

src/main/lib/analytics.ts:112–130  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

110 * Initialize PostHog for main process
111 */
112export function initAnalytics() {
113 // Skip in development mode
114 if (isDev()) return
115
116 if (posthog) return
117
118 // Skip if no PostHog key configured
119 if (!POSTHOG_DESKTOP_KEY) {
120 console.log("[Analytics] Skipping PostHog initialization (no key configured)")
121 return
122 }
123
124 posthog = new PostHog(POSTHOG_DESKTOP_KEY, {
125 host: POSTHOG_HOST,
126 // Flush events every 30 seconds or when 20 events are queued
127 flushAt: 20,
128 flushInterval: 30000,
129 })
130}
131
132/**
133 * Capture an analytics event

Callers 1

index.tsFile · 0.90

Calls 1

isDevFunction · 0.70

Tested by

no test coverage detected