Skip to content

Channel Usage Analytics

Channel Usage Analytics provides insights into how your peer interacts across different communication channels. Track message volumes, conversation counts, and channel distribution to optimize your peer's deployment.

Overview

Channel Usage Analytics helps you:

  • Monitor Activity: See which channels receive the most interactions
  • Optimize Resources: Identify high-traffic channels for scaling
  • Track Growth: Monitor conversation and message trends
  • Compare Channels: Understand channel performance differences
  • Plan Integrations: Make data-driven decisions about new channels

Accessing Analytics

In Peer Detail View

  1. Navigate to Peers → Select your peer
  2. Scroll to Channel Usage section
  3. View real-time statistics for all active channels

Via API

http
GET /api/v1/peer/:peerId/channel-stats

Available Metrics

Per-Channel Metrics

Each channel displays:

  • Message Count: Total user messages received
  • Conversation Count: Number of unique conversations
  • Percentage: Share of total peer traffic
  • Visual Progress: Bar chart showing relative usage

Total Statistics

  • Total Messages: Aggregate across all channels
  • Channel Distribution: Visual breakdown by channel
  • Top Performers: Channels sorted by activity

Channel Types

Integrated Channels

Channels connected via integrations:

  • Slack: Messages from Slack workspace
  • Email: Conversations via email integration
  • Discord: Discord server interactions
  • WhatsApp: WhatsApp messages
  • Telegram: Telegram bot conversations
  • Custom Integrations: Any configured integration

Direct/Web Channel

Built-in channels:

  • Direct: Messages via peer detail page chat
  • WebChat: Messages from embedded WebChat widget
  • API: Direct API calls to peer

Usage Examples

Example 1: Multi-Channel Support Peer

┌─────────────────────────────────────────────┐
│ Channel Usage              12,450 messages  │
├─────────────────────────────────────────────┤
│                                             │
│ 🌐 WebChat                    8,245 (66.2%) │
│ ████████████████████████░░░░░░              │
│ 485 conversations                           │
│                                             │
│ 💬 Slack                      2,890 (23.2%) │
│ ████████░░░░░░░░░░░░░░░░░░░░                │
│ 156 conversations                           │
│                                             │
│ 📧 Email                      1,120 (9.0%)  │
│ ███░░░░░░░░░░░░░░░░░░░░░░░░░                │
│ 78 conversations                            │
│                                             │
│ 🖥️ Direct/Web                  195 (1.6%)   │
│ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░                │
│ 12 conversations                            │
└─────────────────────────────────────────────┘

Insights:

  • WebChat is the primary channel (66%)
  • Slack provides significant traffic (23%)
  • Email serves specific use cases (9%)
  • Direct access used for testing/demos

Example 2: Internal HR Peer

┌─────────────────────────────────────────────┐
│ Channel Usage               3,240 messages  │
├─────────────────────────────────────────────┤
│                                             │
│ 💬 Slack                      2,950 (91.0%) │
│ ████████████████████████████░               │
│ 890 conversations                           │
│                                             │
│ 🖥️ Direct/Web                  290 (9.0%)   │
│ ███░░░░░░░░░░░░░░░░░░░░░░░░░                │
│ 45 conversations                            │
└─────────────────────────────────────────────┘

Insights:

  • Slack-first deployment strategy
  • Heavy internal user adoption
  • Direct channel for HR team testing

API Integration

Get Channel Statistics

Endpoint:

http
GET /api/v1/peer/:peerId/channel-stats

Headers:

http
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

Response:

json
{
  "channels": [
    {
      "channelId": "integration_123",
      "channelName": "WebChat",
      "galleryKey": "webchat",
      "conversationCount": 485,
      "messageCount": 8245
    },
    {
      "channelId": "integration_456",
      "channelName": "Slack Support",
      "galleryKey": "slack",
      "conversationCount": 156,
      "messageCount": 2890
    },
    {
      "channelId": "direct",
      "channelName": "Direct/Web",
      "conversationCount": 12,
      "messageCount": 195
    }
  ],
  "total": {
    "conversationCount": 653,
    "messageCount": 11330
  }
}

JavaScript Example

javascript
async function getChannelStats(peerId, apiKey) {
  const response = await fetch(
    `/api/v1/peer/${peerId}/channel-stats`,
    {
      headers: {
        'Authorization': `Bearer ${apiKey}`,
        'Content-Type': 'application/json'
      }
    }
  );
  
  const data = await response.json();
  
  // Calculate percentages
  const stats = data.channels.map(channel => ({
    ...channel,
    percentage: (
      (channel.messageCount / data.total.messageCount) * 100
    ).toFixed(1)
  }));
  
  return {
    channels: stats,
    total: data.total
  };
}

// Usage
const stats = await getChannelStats('peer_123', 'your-api-key');
console.log(`Total messages: ${stats.total.messageCount}`);
stats.channels.forEach(channel => {
  console.log(`${channel.channelName}: ${channel.messageCount} (${channel.percentage}%)`);
});

Python Example

python
import requests
from typing import Dict, List

def get_channel_stats(peer_id: str, api_key: str) -> Dict:
    """Fetch channel usage statistics for a peer"""
    response = requests.get(
        f'/api/v1/peer/{peer_id}/channel-stats',
        headers={
            'Authorization': f'Bearer {api_key}',
            'Content-Type': 'application/json'
        }
    )
    
    data = response.json()
    
    # Add percentage calculations
    total_messages = data['total']['messageCount']
    for channel in data['channels']:
        channel['percentage'] = round(
            (channel['messageCount'] / total_messages) * 100, 1
        ) if total_messages > 0 else 0
    
    return data

# Usage
stats = get_channel_stats('peer_123', 'your-api-key')
print(f"Total messages: {stats['total']['messageCount']}")

# Sort by message count
sorted_channels = sorted(
    stats['channels'],
    key=lambda x: x['messageCount'],
    reverse=True
)

for channel in sorted_channels:
    print(f"{channel['channelName']}: {channel['messageCount']} ({channel['percentage']}%)")

Use Cases

1. Resource Allocation

Scenario: Determine which channels need more attention

Analysis:

javascript
const stats = await getChannelStats('peer_123', apiKey);

// Find high-traffic channels (>30% of total)
const highTrafficChannels = stats.channels.filter(
  ch => (ch.messageCount / stats.total.messageCount) > 0.3
);

console.log('High-traffic channels requiring monitoring:');
highTrafficChannels.forEach(ch => {
  console.log(`- ${ch.channelName}: ${ch.messageCount} messages`);
});

2. Channel Performance Comparison

Scenario: Compare message-to-conversation ratios

Analysis:

javascript
const stats = await getChannelStats('peer_123', apiKey);

const ratios = stats.channels.map(ch => ({
  name: ch.channelName,
  ratio: (ch.messageCount / ch.conversationCount).toFixed(1),
  engagement: ch.messageCount / ch.conversationCount > 5 ? 'High' : 'Low'
}));

console.log('Channel engagement levels:');
ratios.forEach(r => {
  console.log(`${r.name}: ${r.ratio} msgs/conv (${r.engagement})`);
});

3. Growth Tracking

Scenario: Monitor channel adoption over time

Implementation:

javascript
// Store stats daily
async function trackDailyStats(peerId, apiKey) {
  const stats = await getChannelStats(peerId, apiKey);
  
  await database.save({
    date: new Date(),
    peerId: peerId,
    channels: stats.channels,
    total: stats.total
  });
}

// Compare week-over-week growth
async function calculateGrowth(peerId, weeks = 4) {
  const history = await database.query({
    peerId,
    date: { $gte: subtractWeeks(new Date(), weeks) }
  });
  
  // Calculate growth per channel
  // ... implementation
}

4. Channel Health Monitoring

Scenario: Alert on unusual patterns

Implementation:

javascript
async function monitorChannelHealth(peerId, apiKey) {
  const stats = await getChannelStats(peerId, apiKey);
  
  // Check for inactive channels
  const inactiveChannels = stats.channels.filter(
    ch => ch.messageCount === 0
  );
  
  if (inactiveChannels.length > 0) {
    sendAlert('Inactive channels detected', inactiveChannels);
  }
  
  // Check for imbalanced distribution
  const topChannel = stats.channels[0];
  const topPercentage = 
    (topChannel.messageCount / stats.total.messageCount) * 100;
  
  if (topPercentage > 90) {
    sendAlert('Heavy reliance on single channel', topChannel);
  }
}

Dashboard Integration

React Component Example

jsx
import { useQuery } from '@tanstack/react-query';
import { Card, Progress, Badge } from '@mantine/core';

function ChannelUsageDashboard({ peerId }) {
  const { data } = useQuery({
    queryKey: ['channel-stats', peerId],
    queryFn: () => fetchChannelStats(peerId),
  });

  const totalMessages = data?.total?.messageCount || 0;

  return (
    <Card>
      <h3>Channel Usage</h3>
      <Badge>{totalMessages} messages</Badge>
      
      {data?.channels
        .sort((a, b) => b.messageCount - a.messageCount)
        .map(channel => {
          const percentage = 
            ((channel.messageCount / totalMessages) * 100).toFixed(1);
          
          return (
            <div key={channel.channelId}>
              <div className="channel-header">
                <span>{channel.channelName}</span>
                <span>{channel.messageCount}</span>
              </div>
              <Progress value={parseFloat(percentage)} />
              <small>{channel.conversationCount} conversations · {percentage}%</small>
            </div>
          );
        })}
    </Card>
  );
}

Vue Component Example

vue
<template>
  <div class="channel-usage">
    <h3>Channel Usage</h3>
    <div class="total-badge">{{ totalMessages }} messages</div>
    
    <div 
      v-for="channel in sortedChannels" 
      :key="channel.channelId"
      class="channel-card"
    >
      <div class="channel-header">
        <span>{{ channel.channelName }}</span>
        <span>{{ channel.messageCount }}</span>
      </div>
      <div class="progress-bar">
        <div 
          class="progress-fill" 
          :style="{ width: channel.percentage + '%' }"
        ></div>
      </div>
      <div class="channel-footer">
        {{ channel.conversationCount }} conversations · {{ channel.percentage }}%
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: ['peerId'],
  computed: {
    sortedChannels() {
      return this.channels
        .map(ch => ({
          ...ch,
          percentage: (
            (ch.messageCount / this.totalMessages) * 100
          ).toFixed(1)
        }))
        .sort((a, b) => b.messageCount - a.messageCount);
    }
  }
};
</script>

Best Practices

1. Regular Monitoring

Do:

  • Check statistics weekly
  • Track trends over time
  • Set up automated reports
  • Monitor for anomalies

Don't:

  • Rely on single snapshots
  • Ignore sudden changes
  • Neglect inactive channels

2. Channel Strategy

Do:

  • Match channels to user preferences
  • Provide consistent experience across channels
  • Optimize high-traffic channels first
  • Test new channels before full rollout

Don't:

  • Force users to specific channels
  • Neglect less-used channels
  • Assume all channels need equal resources

3. Data-Driven Decisions

Do:

  • Use metrics to guide integration priorities
  • A/B test channel configurations
  • Analyze conversation patterns per channel
  • Correlate channel with user satisfaction

Don't:

  • Make decisions based on assumptions
  • Ignore user behavior patterns
  • Overlook channel-specific needs

Troubleshooting

No Statistics Showing

Possible Causes:

  • No conversations yet
  • Channels not properly configured
  • Integration connection issues

Solutions:

  • Verify peer has received messages
  • Check integration status
  • Test with a sample message

Incorrect Counts

Possible Causes:

  • Only user messages counted
  • Archived conversations excluded
  • Time zone differences

Solutions:

  • Statistics count user messages only (not AI responses)
  • Archive status doesn't affect counts
  • All times are in UTC

Missing Channels

Possible Causes:

  • Integration recently removed
  • No messages on that channel yet
  • Integration disabled

Solutions:

  • Check integration list
  • Send test message
  • Verify integration is active

Advanced Analytics

Custom Reporting

Build custom reports using the API:

javascript
async function generateMonthlyReport(peerId, apiKey) {
  const stats = await getChannelStats(peerId, apiKey);
  
  const report = {
    period: 'October 2025',
    peer: peerId,
    overview: {
      totalMessages: stats.total.messageCount,
      totalConversations: stats.total.conversationCount,
      channelCount: stats.channels.length
    },
    channels: stats.channels.map(ch => ({
      name: ch.channelName,
      messages: ch.messageCount,
      conversations: ch.conversationCount,
      avgMessagesPerConversation: (
        ch.messageCount / ch.conversationCount
      ).toFixed(1),
      marketShare: (
        (ch.messageCount / stats.total.messageCount) * 100
      ).toFixed(1) + '%'
    }))
  };
  
  return report;
}

Integration with Analytics Platforms

Export to Google Analytics, Mixpanel, etc:

javascript
async function exportToAnalytics(peerId, apiKey) {
  const stats = await getChannelStats(peerId, apiKey);
  
  // Google Analytics example
  gtag('event', 'peer_channel_stats', {
    peer_id: peerId,
    total_messages: stats.total.messageCount,
    total_conversations: stats.total.conversationCount,
    channel_count: stats.channels.length
  });
  
  // Track each channel
  stats.channels.forEach(channel => {
    gtag('event', 'channel_usage', {
      peer_id: peerId,
      channel_name: channel.channelName,
      message_count: channel.messageCount,
      conversation_count: channel.conversationCount
    });
  });
}

Summary

Channel Usage Analytics provides essential insights for:

  • Understanding how users interact with your peer
  • Optimizing resource allocation across channels
  • Planning future integration priorities
  • Monitoring channel health and performance
  • Making data-driven decisions

Key Metrics:

  • Message volume per channel
  • Conversation distribution
  • Channel engagement levels
  • Traffic patterns

Use Channel Usage Analytics to maximize your peer's effectiveness across all communication channels!

Built with VitePress