Affinity Design
Agency Guide

Agent Metrics & Performance

Track call volume, booking rates, and agent-level performance metrics

Overview

Agent metrics give you per-agent and per-client performance data: call volume, booking rates, call duration, and AI-handled calls. Metrics are calculated from call history and stored monthly for fast retrieval and period-over-period comparison.

Agent Metrics

Endpoint: GET /admin/reports/agent-metrics/:agentId?clientId=xxx&year=2025&month=3

Returns metrics for a single agent in a specific period:

FieldDescription
agentIdThe agent identifier
periodYYYY-MM
metricsObject containing call and booking data
sourceHow the metrics were derived (computed, cached, etc.)
lastUpdatedWhen metrics were last calculated

Metrics Object

MetricDescription
inboundCallsCalls received by the agent
outboundCallsCalls initiated by the agent
totalCallsInbound + outbound
successfulBookingsCalls that resulted in a booked appointment
totalDurationTotal call duration in seconds
callsFromAICalls handled by the AI agent without human transfer

Combined Client Metrics

Endpoint: GET /admin/reports/combined-metrics?clientId=xxx&year=2025&month=3

Aggregates metrics across all agents for a client:

FieldDescription
agentCountNumber of agents with metrics
agentsArray of per-agent metrics
totalsAggregated totals across all agents

Totals Object

MetricDescription
totalInboundCallsSum of all agent inbound calls
totalOutboundCallsSum of all agent outbound calls
totalCallsTotal calls across all agents
totalSuccessfulBookingsTotal bookings across all agents
totalDurationTotal duration in seconds
totalCallsFromAITotal AI-handled calls
averageDurationtotalDuration / totalCalls (rounded)
overallSuccessRate(totalSuccessfulBookings / totalCalls) × 100

Period Comparison

Endpoint: GET /admin/reports/period-comparison?clientId=xxx&agentId=xxx&startPeriod=2025-02&endPeriod=2025-03

Compares a single agent's metrics between two periods. Useful for tracking improvement or decline over time.

Required Parameters

ParameterFormat
clientIdClient ID string
agentIdAgent ID string
startPeriodYYYY-MM (earlier period)
endPeriodYYYY-MM (later period)

Recalculating Metrics

If metrics appear stale or incorrect, you can trigger a recalculation from raw call history:

Endpoint: POST /admin/metrics/recalculate

Body:

{
  "clientId": "client_abc",
  "agentId": "agent_123",
  "year": 2025,
  "month": 3
}

This reprocesses all calls for the agent in the specified period and updates the stored metrics document.

Recalculation is an expensive operation. Use it sparingly — only when you suspect metrics drift or after data migrations.

Appointment Data Sync

The system can sync appointment data from GoHighLevel into agent metrics:

Endpoint: GET /admin/bootstrap/appointments/counts?clientId=xxx&year=2025&month=3

This pulls monthly booking counts from GHL and merges them with the local metrics. Run this when GHL appointment data needs to be backfilled or reconciled with call-based metrics.

Call Outcomes

Calls are tracked with statuses that determine booking success:

StatusMeaning
booked_appointmentCall resulted in a confirmed booking
in_progressCall is currently active
completedCall ended normally without booking
no_answerCall was not picked up
failedCall failed to connect

The booking/success rate in metrics is calculated from booked_appointment calls divided by total calls.

SMS Metrics

SMS activity is tracked alongside calls. While SMS metrics are not currently broken out in the agent metrics endpoints, they appear in the dashboard and can be queried through the call history with appropriate status filters.

Agent Comparison

To compare agents within a client:

  1. Use GET /admin/reports/combined-metrics to get all agent metrics for a period.
  2. Compare successfulBookings, averageDuration, and overallSuccessRate across agents.
  3. Use GET /admin/reports/period-comparison to track individual agent trends over time.

On this page