feat(analytics): integrate analytics across remaining UI components

- Add slash command tracking:
  - Track command selection with method (click/keyboard/autocomplete)
  - Monitor command execution with parameters and timing
  - Record custom command creation events
- Enhance agent execution tracking:
  - Track agent lifecycle (start, progress, completion)
  - Monitor agent errors with retry context
  - Record execution duration and success metrics
- Add tab management analytics:
  - Track tab creation and closure events
  - Monitor active tab switches
- Implement timeline navigation tracking:
  - Track checkpoint navigation events
  - Monitor timeline interactions
- Update useAnalytics hook with comprehensive event helpers
- Export performance monitoring hooks from central index

This completes analytics integration across all major UI components
for full user interaction visibility.
This commit is contained in:
Vivek R
2025-07-31 14:22:47 +05:30
parent f08764c6ea
commit db1efc2831
7 changed files with 584 additions and 8 deletions

View File

@@ -18,6 +18,7 @@ import {
} from "lucide-react";
import type { SlashCommand } from "@/lib/api";
import { cn } from "@/lib/utils";
import { useTrackEvent, useFeatureAdoptionTracking } from "@/hooks";
interface SlashCommandPickerProps {
/**
@@ -88,6 +89,10 @@ export const SlashCommandPicker: React.FC<SlashCommandPickerProps> = ({
const commandListRef = useRef<HTMLDivElement>(null);
// Analytics tracking
const trackEvent = useTrackEvent();
const slashCommandFeatureTracking = useFeatureAdoptionTracking('slash_commands');
// Load commands on mount or when project path changes
useEffect(() => {
loadCommands();
@@ -170,7 +175,13 @@ export const SlashCommandPicker: React.FC<SlashCommandPickerProps> = ({
case 'Enter':
e.preventDefault();
if (filteredCommands.length > 0 && selectedIndex < filteredCommands.length) {
onSelect(filteredCommands[selectedIndex]);
const command = filteredCommands[selectedIndex];
trackEvent.slashCommandSelected({
command_name: command.name,
selection_method: 'keyboard'
});
slashCommandFeatureTracking.trackUsage();
onSelect(command);
}
break;
@@ -218,6 +229,11 @@ export const SlashCommandPicker: React.FC<SlashCommandPickerProps> = ({
};
const handleCommandClick = (command: SlashCommand) => {
trackEvent.slashCommandSelected({
command_name: command.name,
selection_method: 'click'
});
slashCommandFeatureTracking.trackUsage();
onSelect(command);
};
@@ -546,4 +562,4 @@ export const SlashCommandPicker: React.FC<SlashCommandPickerProps> = ({
</div>
</motion.div>
);
};
};