-
Notifications
You must be signed in to change notification settings - Fork 673
feat(telemetry): instrument cloud funnel gaps + enable cloud web analytics #12935
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,9 @@ | |
|
|
||
| import type { | ||
| AuthMetadata, | ||
| BillingCycleToggledMetadata, | ||
| AuthErrorMetadata, | ||
| TemplateCategorySelectedMetadata, | ||
| DefaultViewSetMetadata, | ||
| EnterLinearMetadata, | ||
| ShareFlowMetadata, | ||
|
|
@@ -126,9 +129,14 @@ | |
| api_host: | ||
| window.__CONFIG__?.posthog_api_host || 'https://t.comfy.org', | ||
| ui_host: 'https://us.posthog.com', | ||
| autocapture: false, | ||
| capture_pageview: false, | ||
| capture_pageleave: false, | ||
| // Web analytics enabled so cloud.comfy.org gets heatmaps + $pageview | ||
| // (the login/onboarding pages previously had zero coverage). autocapture | ||
| // does NOT record input *values* (posthog masks them), and these defaults | ||
| // remain overridable per-environment via `serverConfig` (spread below). | ||
| autocapture: true, | ||
| capture_pageview: true, | ||
| capture_pageleave: true, | ||
| heatmaps: true, | ||
|
Check failure on line 139 in src/platform/telemetry/providers/cloud/PostHogTelemetryProvider.ts
|
||
| persistence: 'localStorage+cookie', | ||
|
Comment on lines
+132
to
140
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result: To enable heatmaps in posthog-js, the correct configuration option to use in the posthog.init call is enable_heatmaps [1][2]. You should set this option to true within the configuration object: posthog.init('<ph_project_token>', { api_host: 'https://us.i.posthog.com', enable_heatmaps: true }) While some internal configuration references or older/alternative settings may show capture_heatmaps [3], the official and documented key for enabling this feature via initialization is enable_heatmaps [1][2]. Note that if you want to disable features, PostHog typically uses a disable_* prefix (e.g., disable_session_recording), but for enabling heatmaps, the enable_heatmaps key is the standard approach [1][3]. Citations:
🏁 Script executed: # Check the PostHogTelemetryProvider.ts file around line 139
sed -n '130,145p' src/platform/telemetry/providers/cloud/PostHogTelemetryProvider.ts
# Also check the PostHog version in package.json
rg '"posthog"' package.json -A 1Repository: Comfy-Org/ComfyUI_frontend Length of output: 1058 🏁 Script executed: # Check PostHog version
rg '"posthog"' package.json -B 1 -A 1
# Also verify the TypeScript error by checking tsconfig
fd -n tsconfigRepository: Comfy-Org/ComfyUI_frontend Length of output: 301 🏁 Script executed: # Check PostHog version
rg '"posthog"' package.json -B 1 -A 1
# Find tsconfig files
fd tsconfigRepository: Comfy-Org/ComfyUI_frontend Length of output: 502 🏁 Script executed: # Find package.json files and check PostHog version
find . -name "package.json" -type f | head -5 | xargs grep -l "posthog"
# Check the root package.json for PostHog
cat package.json | grep -A 2 -B 2 "posthog"Repository: Comfy-Org/ComfyUI_frontend Length of output: 252 🏁 Script executed: # Check pnpm workspace catalog or pnpm-lock.yaml for actual PostHog version
rg 'posthog-js' pnpm-lock.yaml -A 3 | head -20
# Also check the catalog in package.json structure
cat package.json | grep -A 50 "catalog"Repository: Comfy-Org/ComfyUI_frontend Length of output: 5781 🏁 Script executed: # Check if there are any TypeScript definitions for PostHog to see what keys are allowed
rg "interface PostHogConfig" --type ts -A 20
# Also search for any existing usage of enable_heatmaps or heatmaps in the codebase
rg "enable_heatmaps|heatmaps" --type ts -B 2 -A 2Repository: Comfy-Org/ComfyUI_frontend Length of output: 1356 🏁 Script executed: # Check the node_modules PostHog types to see if heatmaps is a valid config key
rg "heatmaps|enable_heatmaps" node_modules/posthog-js -t ts -A 1 -B 1 2>/dev/null | head -30
# Also check what keys are actually defined in PostHogConfig
rg "PostHogConfig" node_modules/posthog-js --type ts -A 30 2>/dev/null | head -50Repository: Comfy-Org/ComfyUI_frontend Length of output: 52 🏁 Script executed: # Check if there's a build or tsc output showing the error
rg "TS2353" . --type ts --type json 2>/dev/null | head -10
# Let's verify the exact line and surrounding context
sed -n '128,145p' src/platform/telemetry/providers/cloud/PostHogTelemetryProvider.ts | cat -nRepository: Comfy-Org/ComfyUI_frontend Length of output: 1249 Replace The PostHog SDK (v1.358.1) does not support the 🧰 Tools🪛 GitHub Actions: CI: Dist Telemetry Scan / 0_scan.txt[error] 139-139: TypeScript (vue-tsc) error TS2353: Object literal may only specify known properties; 'heatmaps' does not exist in type 'Partial'. 🪛 GitHub Actions: CI: Dist Telemetry Scan / scan[error] 139-139: TypeScript (vue-tsc) error TS2353: Object literal may only specify known properties, and 'heatmaps' does not exist in type 'Partial'. 🪛 GitHub Actions: CI: OSS Assets Validation / 1_validate-fonts.txt[error] 139-139: TypeScript (vue-tsc) failed with TS2353: Object literal may only specify known properties; property 'heatmaps' does not exist in type 'Partial'. 🪛 GitHub Actions: CI: OSS Assets Validation / validate-fonts[error] 139-139: TypeScript (vue-tsc) error TS2353: Object literal may only specify known properties, and 'heatmaps' does not exist in type 'Partial'. 🪛 GitHub Check: scan[failure] 139-139: 🪛 GitHub Check: validate-fonts[failure] 139-139: 🤖 Prompt for AI AgentsSources: Linters/SAST tools, Pipeline failures |
||
| debug: import.meta.env.VITE_POSTHOG_DEBUG === 'true', | ||
| ...serverConfig, | ||
|
|
@@ -350,6 +358,20 @@ | |
| this.trackEvent(eventName, metadata) | ||
| } | ||
|
|
||
| trackBillingCycleToggled(metadata: BillingCycleToggledMetadata): void { | ||
| this.trackEvent(TelemetryEvents.BILLING_CYCLE_TOGGLED, metadata) | ||
| } | ||
|
|
||
| trackAuthError(metadata: AuthErrorMetadata): void { | ||
| this.trackEvent(TelemetryEvents.AUTH_ERROR, metadata) | ||
| } | ||
|
|
||
| trackTemplateCategorySelected( | ||
| metadata: TemplateCategorySelectedMetadata | ||
| ): void { | ||
| this.trackEvent(TelemetryEvents.TEMPLATE_CATEGORY_SELECTED, metadata) | ||
| } | ||
|
|
||
| trackAddApiCreditButtonClicked(): void { | ||
| this.trackEvent(TelemetryEvents.ADD_API_CREDIT_BUTTON_CLICKED) | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Category-selection telemetry fires on internal sort-driven nav resets.
Line 549 watches all
selectedNavItemchanges, but Line 622 also setsselectedNavItemprogrammatically (popular→all) when sort changes. That meanstrackTemplateCategorySelectedis emitted for non-user category selections.Proposed fix
🤖 Prompt for AI Agents