Chatbot analytics

From curiositech/windags-skills · View interactive version

Chatbot analytics is an AI agent skill from the GitHub repository curiositech/windags-skills. Implement AI chatbot analytics and conversation monitoring. Use when adding conversation metrics, tracking AI usage, measuring user engagement with chat, or building conversation dashboards. Activates for AI analytics, token tracking, conversation categorization, and chat performance.

How to use this skill

Skill file

AI Chatbot Analytics

This skill helps you implement analytics for the AI coaching chat feature while maintaining HIPAA compliance.

Decision Points

1. Alert Threshold Configuration

IF abandonment_rate > 40% within 24h
  → THEN escalate to admin team
  → ELSE log for trending analysis

IF crisis_escalations > 5 within 24h  
  → THEN send email alert immediately
  → ELSE track for weekly review

IF error_rate > 10% within 1h
  → THEN send Slack alert
  → ELSE continue monitoring

IF token_cost > budget_threshold
  → THEN enable cost controls
  → ELSE continue tracking

2. Category Classification Decision Tree

IF metadata.usedCrisisProtocol == true
  → category = "crisis_support"
ELSE IF metadata.usedCopingStrategies == true
  → category = "coping_strategies"  
ELSE IF metadata.usedCheckInSupport == true
  → category = "checkin_support"
ELSE IF metadata.requestedClarification == true
  → category = "clarification"
ELSE
  → category = "general_chat"

3. Data Storage Compliance Check

IF data_contains(PHI_indicators)
  → REJECT storage, log metadata only
ELSE IF data_is_aggregate()
  → STORE for analytics
ELSE IF data_is_metadata()
  → STORE with encryption
ELSE
  → REVIEW manually before storage

Failure Modes

1. **PHI Leakage**

2. **Alert Fatigue**

3. **Token Cost Explosion**

4. **Incomplete Session Tracking**

5. **Slow Query Performance**

Worked Example

Scenario: Implementing Crisis Escalation Tracking

Setup: User reports feeling overwhelmed, AI detects crisis indicators

// 1. Start tracking conversation
await trackConversationStart('conv-789', 'user-123');

// 2. AI processes message and sets metadata flags
const aiResponse = await processMessage(userMessage);
const metadata = {
  usedCrisisProtocol: true,
  usedCopingStrategies: false,
  requestedClarification: false
};

// 3. Expert decision: Check crisis threshold first
if (metadata.usedCrisisProtocol) {
  // Set category immediately
  const category = 'crisis_support';
  
  // Track the exchange with crisis flag
  await trackMessageExchange('conv-789', 
    { input: 150, output: 300 },
    1200, // 1.2s response time
    { hadFallback: false, hasCrisisIndicator: true }
  );
}

// 4. End conversation with escalation
await trackConversationEnd('conv-789', 'crisis_escalated');

// 5. Check if alert threshold reached
const recentCrises = await countCrisisEscalations(24); // last 24h
if (recentCrises > 5) {
  await sendAlert('crisis_spike', { count: recentCrises });
}

Expert catches: The crisis flag triggers immediate categorization and outcome tracking, bypassing normal conversation flow analysis.

Novice misses: Would wait until conversation end to classify, missing real-time escalation opportunity.

Quality Gates

NOT-FOR Boundaries

Do NOT use this skill for:

Delegate when:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.