Skip to main content

Analytics

cstar.analytics rolls up the numbers — ticket volume, response times, CSAT, library usage, agent performance. Most calls accept a period filter; pair them with agentId for per-person breakdowns.

Overview

overview.js
const overview = await cstar.analytics.overview({
  period: 'week',          // 'day' | 'week' | 'month' | 'year' | 'all'
  agentId: 'mem_abc123'    // Omit for team-wide totals
});

Agent performance

performance.js
const performance = await cstar.analytics.performance({
  period: 'month',
  agentId: 'mem_abc123'
});

Library stats

How the public knowledge base is performing — top articles, search queries, view counts.

library.js
const library = await cstar.analytics.library({ period: 'month' });

CSAT

csat.js
// Aggregate stats
const stats = await cstar.analytics.csatStats({ period: 'month' });

// Per-agent stats
const agentStats = await cstar.analytics.csatStats({
  period: 'month',
  agentId: 'mem_abc123'
});

// Read + update CSAT delivery settings
const settings = await cstar.analytics.csatSettings();
await cstar.analytics.updateCsatSettings({ deliveryMode: 'after_resolved' });

CSAT surveys (cstar.csat)

Build, list, and inspect individual survey records. cstar.csat is the resource for the survey rows themselves; the rollups above live on cstar.analytics.

csat-surveys.js
const { data: surveys } = await cstar.csat.list({
  rating: '5',
  agentId: 'mem_abc123',
  page: 1,
  pageSize: 20
});

const survey = await cstar.csat.get('csat_abc123');

const created = await cstar.csat.create({
  ticketId: 'tkt_abc123',
  rating: 5,
  comment: 'Fast and friendly!'
});

Next up