---
title: "Action statistic__set"
description: "Stores an NPS or quality score after a closed operator dialog."
---

# Action `statistic__set`

> **System ID:** `action_statistic__set`  
> Also in scenario: `statistic__set`

## Description

Stores a satisfaction survey result (NPS or quality) after a closed operator chat: updates the last chat-close statistics, the chat room CSAT, and creates a statistics record. The type is set by the `type` parameter.

For simply saving answers to the NPS table, see also [`operator_panel__nps_confirm_answer`](/en/actionjail/reference/actions/operator_panel__nps_confirm_answer.md).

## Events (scenario branches)

| Event | When it occurs |
|-------|----------------|
| **success** | Statistics saved |
| **error** | Invalid `type`, missing score / comment, no chat-close statistics, or save failure |

## Parameters

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `type` | string | yes | `nps` | Survey type: `nps` or `quality` |

User constants:

| Type | Constant | Description |
|------|----------|-------------|
| `nps` | `nps_answer` | NPS score (number) |
| `nps` | `quality_comment` | Optional comment |
| `quality` | `quality_answer` | Quality score |
| `quality` | `quality_comment` | Optional comment |

## Configuration example

```json
{
  "type": "nps"
}
```

Constants:

```json
{
  "nps_answer": 9,
  "quality_comment": "Thank you!"
}
```

## Related docs

- [Actions reference](/en/actionjail/reference/actions-reference.md)
- [Action operator_panel__nps_confirm_answer](/en/actionjail/reference/actions/operator_panel__nps_confirm_answer.md)
