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:
@@ -36,7 +36,7 @@ import { ErrorBoundary } from "./ErrorBoundary";
|
||||
import { useVirtualizer } from "@tanstack/react-virtual";
|
||||
import { AGENT_ICONS } from "./CCAgents";
|
||||
import { HooksEditor } from "./HooksEditor";
|
||||
import { useTrackEvent, useComponentMetrics } from "@/hooks";
|
||||
import { useTrackEvent, useComponentMetrics, useFeatureAdoptionTracking } from "@/hooks";
|
||||
|
||||
interface AgentExecutionProps {
|
||||
/**
|
||||
@@ -93,6 +93,7 @@ export const AgentExecution: React.FC<AgentExecutionProps> = ({
|
||||
// Analytics tracking
|
||||
const trackEvent = useTrackEvent();
|
||||
useComponentMetrics('AgentExecution');
|
||||
const agentFeatureTracking = useFeatureAdoptionTracking(`agent_${agent.name || 'custom'}`);
|
||||
|
||||
// Hooks configuration state
|
||||
const [isHooksDialogOpen, setIsHooksDialogOpen] = useState(false);
|
||||
@@ -308,7 +309,14 @@ export const AgentExecution: React.FC<AgentExecutionProps> = ({
|
||||
setRunId(executionRunId);
|
||||
|
||||
// Track agent execution start
|
||||
trackEvent.agentExecuted(agent.name || 'custom', true, agent.name, undefined);
|
||||
trackEvent.agentStarted({
|
||||
agent_type: agent.name || 'custom',
|
||||
agent_name: agent.name,
|
||||
has_custom_prompt: task !== agent.default_task
|
||||
});
|
||||
|
||||
// Track feature adoption
|
||||
agentFeatureTracking.trackUsage();
|
||||
|
||||
// Set up event listeners with run ID isolation
|
||||
const outputUnlisten = await listen<string>(`agent-output:${executionRunId}`, (event) => {
|
||||
@@ -327,6 +335,14 @@ export const AgentExecution: React.FC<AgentExecutionProps> = ({
|
||||
const errorUnlisten = await listen<string>(`agent-error:${executionRunId}`, (event) => {
|
||||
console.error("Agent error:", event.payload);
|
||||
setError(event.payload);
|
||||
|
||||
// Track agent error
|
||||
trackEvent.agentError({
|
||||
error_type: 'runtime_error',
|
||||
error_stage: 'execution',
|
||||
retry_count: 0,
|
||||
agent_type: agent.name || 'custom'
|
||||
});
|
||||
});
|
||||
|
||||
const completeUnlisten = await listen<boolean>(`agent-complete:${executionRunId}`, (event) => {
|
||||
@@ -335,7 +351,14 @@ export const AgentExecution: React.FC<AgentExecutionProps> = ({
|
||||
setExecutionStartTime(null);
|
||||
if (!event.payload) {
|
||||
setError("Agent execution failed");
|
||||
// Track both the old event for compatibility and the new error event
|
||||
trackEvent.agentExecuted(agent.name || 'custom', false, agent.name, duration);
|
||||
trackEvent.agentError({
|
||||
error_type: 'execution_failed',
|
||||
error_stage: 'completion',
|
||||
retry_count: 0,
|
||||
agent_type: agent.name || 'custom'
|
||||
});
|
||||
} else {
|
||||
trackEvent.agentExecuted(agent.name || 'custom', true, agent.name, duration);
|
||||
}
|
||||
|
Reference in New Issue
Block a user