# Widget events (/docs/developers/events)

The widget emits events as users interact with it. Use them to measure adoption in your own analytics, or to connect Skavelo to other tools.

```js
const skavelo = Skavelo.init({ agentId: 'YOUR_AGENT_ID' });

skavelo.on('walkthrough_complete', (event) => {
  analytics.track('guide_completed', { workflowId: event.workflowId });
});
```

In React, use [`useSkaveloEvent`](/docs/developers/react#useskaveloevent).

## Events [#events]

| Event | Fires when | Fields |
| --- | --- | --- |
| `open` | The widget opens | |
| `close` | The widget closes | |
| `answer` | Skavelo answers a question | `messageId` |
| `step` | A walkthrough step is shown | `stepIndex`, `stepInstruction`, `elementFound` |
| `step_complete` | The user completes a step | `stepIndex` |
| `walkthrough_start` | A walkthrough begins | `workflowId`, `source` (`asked`, `code` for `startWorkflow`, or `offer`) |
| `walkthrough_complete` | The user finishes a walkthrough | `workflowId` |
| `walkthrough_abandon` | A walkthrough ends before the last step | `workflowId`, `atStep` |
| `walkthrough_replay` | The user chooses **Show me again** after finishing a walkthrough, which starts it again from the first step | `workflowId` |
| `offer` | A [walkthrough offer](/docs/walkthroughs/walkthrough-offers) is shown, accepted or dismissed with Not now | `offerId`, `workflowId`, `action` (`shown`, `accepted` or `dismissed`) |
| `do_approved` | The user approves a skill | `skillId` |
| `lookup` | Skavelo read the user's data with a lookup before answering | `skillId`, `ok` (false when your app refused or didn't reply) |
| `stuck` | Skavelo offered help because the user seemed stuck, and again when they accept or close it | `kind` (`disabled`, `error` or `repeat`), `question`, `accepted` (set once they choose) |
| `do_rejected` | The user cancels a skill | `skillId` |
| `handoff` | The user asks to reach your team | See below |

## The handoff event [#the-handoff-event]

| Field | Description |
| --- | --- |
| `conversationId` | The conversation's ID, matching the one in your dashboard |
| `reason` | `'asked'`, `'unhelpful'` or `'no_answer'` |
| `channel` | `'chat:intercom'` (or another chat tool), `'email'` or `'code'` |
| `summary` | A short message for your team: what the user asked, and on which page |
| `question` | The user's last question |
| `diagnosis` | When the user reported a problem: what Skavelo checked and the likely cause. Also included in `summary`. |
| `pageUrl` | The page the user was on |

See [Hand conversations to your team](/docs/conversations/handoff).
