Skip to content
Open Screeb

Copilot event tracking

Track the prompts, responses, conversions and ratings of your AI copilot so Screeb can measure the quality of its conversations.

If your product has an AI copilot, track each conversation turn as a copilot event. Screeb uses these events to analyze the conversations and show the results in Agent analytics: see Agent analytics.

Track two events on every turn of a conversation, the user prompt and the copilot response, and add the optional conversion and satisfaction events to measure success. Every event accepts extra properties of your own, next to the ones listed below.

Send screeb_copilot_user_prompt when the user sends a message to the copilot:

$screeb("event.copilot", "screeb_copilot_user_prompt", {
prompt: "How can I export my data?",
conversation_id: "conv_123",
session_id: "sess_456",
agent_id: "support_agent",
});

Send screeb_copilot_response when the copilot answers:

$screeb("event.copilot", "screeb_copilot_response", {
response: "You can export your data from the Settings page.",
conversation_id: "conv_123",
session_id: "sess_456",
agent_id: "support_agent",
});
Property Type Required
prompt string On screeb_copilot_user_prompt
response string On screeb_copilot_response
conversation_id string Yes
session_id string Yes
agent_id string Yes

The command fails when a required property is missing.

The most common mistake is to send the prompt and the response once, at the start of the conversation. Send both again on every turn, with the same conversation_id, session_id and agent_id for as long as the conversation lasts. If your tracked conversations stop after one or two events, check this first.

// Created once, when the conversation starts, then reused on every turn.
const conversationId = `conv_${crypto.randomUUID()}`;
const sessionId = `sess_${crypto.randomUUID()}`;
const agentId = "support_agent";
async function handleUserMessage(prompt) {
$screeb("event.copilot", "screeb_copilot_user_prompt", {
prompt,
conversation_id: conversationId,
session_id: sessionId,
agent_id: agentId,
});
const response = await copilot.ask(prompt);
$screeb("event.copilot", "screeb_copilot_response", {
response,
conversation_id: conversationId,
session_id: sessionId,
agent_id: agentId,
});
return response;
}

Send screeb_copilot_conversion when a copilot interaction leads to a result that matters to you, such as a purchase, a sign-up or a completed workflow. Only agent_id is required; conversation_id and session_id link the conversion to a conversation.

$screeb("event.copilot", "screeb_copilot_conversion", {
agent_id: "support_agent",
conversation_id: "conv_123",
session_id: "sess_456",
});

Send screeb_copilot_satisfaction when the user rates the copilot. rating and rating_scale are strings, and every property below is required.

$screeb("event.copilot", "screeb_copilot_satisfaction", {
rating: "4",
rating_scale: "5",
conversation_id: "conv_123",
session_id: "sess_456",
agent_id: "support_agent",
});

When the conversation does not go through the browser, send the same events to POST https://api.screeb.app/1.0/event with the copilot event type and the same event_name values:

Terminal window
curl -X POST https://api.screeb.app/1.0/event \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <API-TOKEN>" \
-d '[
{
"user_alias": "<USER-ID>",
"type": "copilot",
"event_name": "screeb_copilot_user_prompt",
"agent_id": "support_agent",
"conversation_id": "conv_123",
"copilot_session_id": "sess_456",
"prompt": "How can I export my data?"
}
]'

Some field names differ from the tag: session_id becomes copilot_session_id. See the copilot event type of the Screeb API for every field, the authorization and the rate limits.