Issue Description
The implement-via button click handlers (Claude Code, Cursor, GitHub Copilot) were not tracking user actions in Google Analytics 4. This was caused by a dynamic import of the analytics service that was failing silently.
Root Cause
The dynamic import was performed inside a try-catch block with an empty catch statement:
try {
const analyticsModule = await import(getExtensionUrl('utils/analytics-service.js'));
// ... tracking logic
} catch (err) {
/* silent */
}
This two-level closure chain caused the import to fail silently without any error reporting, preventing analytics events from being sent to GA4.
Solution
Replaced the dynamic import with a static import at the module level:
import { trackUserAction } from '../analytics-service.js';
This ensures that:
- The analytics service is properly imported and available
- Click events on implement-via buttons are tracked correctly
- Analytics failures are no longer silently swallowed
Files Modified
utils/ide-integration/claude-code-suggestion.js
utils/ide-integration/cursor-suggestion.js
utils/ide-integration/github-copilot-suggestion.js
Additional Changes
- Removed duplicated
listSection logic by reusing the already-computed itemKind variable
- Added
prompt_truncated to analytics tracking payload for better event instrumentation
Related PR
Fixes: #233
Issue Description
The implement-via button click handlers (Claude Code, Cursor, GitHub Copilot) were not tracking user actions in Google Analytics 4. This was caused by a dynamic import of the analytics service that was failing silently.
Root Cause
The dynamic import was performed inside a try-catch block with an empty catch statement:
This two-level closure chain caused the import to fail silently without any error reporting, preventing analytics events from being sent to GA4.
Solution
Replaced the dynamic import with a static import at the module level:
This ensures that:
Files Modified
utils/ide-integration/claude-code-suggestion.jsutils/ide-integration/cursor-suggestion.jsutils/ide-integration/github-copilot-suggestion.jsAdditional Changes
listSectionlogic by reusing the already-computeditemKindvariableprompt_truncatedto analytics tracking payload for better event instrumentationRelated PR
Fixes: #233