To help track agent performance,
Dialogflow provides tools for collecting
and analyzing end-user feedback on agent answers during a conversation.

## Enable feedback

To collect answer feedback, enable the following settings in
[general agent settings](https://docs.cloud.google.com/dialogflow/cx/docs/concept/agent-settings.md.txt#user-feedback):

1. In the console, open your agent and click the settings icon in the top-right corner (or click **Agent Settings** in the Dialogflow CX console).
2. On the **General** tab, scroll to **Logging settings** and select **Enable conversation history**.
3. Scroll to **User feedback** and select **Enable user feedback**.
4. Click **Save**.

> [!NOTE]
> **Note:** You must select **Enable conversation history** before you can select **Enable user feedback**. If conversation history is disabled, the user feedback setting is disabled.

## Collect feedback with Dialogflow CX Messenger

If you use
[Dialogflow CX Messenger](https://docs.cloud.google.com/dialogflow/cx/docs/concept/integration/dialogflow-messenger.md.txt),
you can enable answer feedback collection for the chat dialog by setting the following
[HTML attribute](https://docs.cloud.google.com/dialogflow/cx/docs/concept/integration/dialogflow-messenger.md.txt#html-customize):
`allow-feedback="all"`.

This will add thumbs up
and thumbs down
buttons to the user interface.
During the conversation,
an end-user can click these buttons to provide feedback on the agent responses.
If the user selects thumbs down,
they can optionally provide a reason for the negative feedback.

## Collect feedback with custom user interfaces

If you have developed a custom user interface,
you can add feedback collection to your interface
and call the `Sessions.submitAnswerFeedback` method.


<button class="devsite-dialog-button cloud-button cloud-button--primary" style="display: block; padding: 10px; margin-top: 10px; margin-bottom: 10px;" data-modal-dialog-id="cx-agent-reference-dialog-Session">Go to the Session API reference</button>
**Select a protocol and version for the Session reference:**

| Protocol | V3 | V3beta1 |
|---|---|---|
| REST | [Session resource](https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3/projects.locations.agents.sessions.md.txt) | [Session resource](https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/projects.locations.agents.sessions.md.txt) |
| RPC | [Session interface](https://docs.cloud.google.com/dialogflow/cx/docs/reference/rpc/google.cloud.dialogflow.cx.v3.md.txt#google.cloud.dialogflow.cx.v3.Sessions) | [Session interface](https://docs.cloud.google.com/dialogflow/cx/docs/reference/rpc/google.cloud.dialogflow.cx.v3beta1.md.txt#google.cloud.dialogflow.cx.v3beta1.Sessions) |
| C++ | [SessionsClient](https://googleapis.dev/cpp/google-cloud-dialogflow_cx/latest/classgoogle_1_1cloud_1_1dialogflow__cx_1_1SessionsClient.html) | Not available |
| C# | [SessionsClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.Cx.V3/latest/Google.Cloud.Dialogflow.Cx.V3.SessionsClient.md.txt) | Not available |
| Go | [SessionsClient](https://docs.cloud.google.com/go/docs/reference/cloud.google.com/go/dialogflow/latest/cx/apiv3.md.txt#cloud_google_com_go_dialogflow_cx_apiv3_SessionsClient) | Not available |
| Java | [SessionsClient](https://docs.cloud.google.com/java/docs/reference/google-cloud-dialogflow-cx/latest/com.google.cloud.dialogflow.cx.v3.SessionsClient.md.txt) | [SessionsClient](https://docs.cloud.google.com/java/docs/reference/google-cloud-dialogflow-cx/latest/com.google.cloud.dialogflow.cx.v3beta1.SessionsClient.md.txt) |
| Node.js | [SessionsClient](https://googleapis.dev/nodejs/dialogflow-cx/latest/v3.SessionsClient.html) | [SessionsClient](https://googleapis.dev/nodejs/dialogflow-cx/latest/v3beta1.SessionsClient.html) |
| PHP | Not available | Not available |
| Python | [SessionsClient](https://docs.cloud.google.com/python/docs/reference/dialogflow-cx/latest/google.cloud.dialogflowcx_v3.services.sessions.SessionsClient.md.txt) | [SessionsClient](https://docs.cloud.google.com/python/docs/reference/dialogflow-cx/latest/google.cloud.dialogflowcx_v3beta1.services.sessions.SessionsClient.md.txt) |
| Ruby | Not available | Not available |

<button class="devsite-dialog-close">Close</button>

<br />

## Custom feedback data structure

You can have feedback data stored in your custom data structure filling the `answerFeedback.customRating` field in the
`Sessions.submitAnswerFeedback` method.

If you use [Dialogflow CX Messenger](https://docs.cloud.google.com/dialogflow/cx/docs/concept/integration/dialogflow-messenger.md.txt),
you can set up custom feedback collection by defining your [custom feedback component](https://docs.cloud.google.com/dialogflow/cx/docs/concept/integration/dialogflow-messenger.md.txt#custom-feedback-component).

## Browse feedback using the Dialogflow CX console

You can access and filter feedbacks using the [Conversation history](https://docs.cloud.google.com/dialogflow/cx/docs/concept/conversation-history.md.txt#browser) tool.

## Read feedback with BigQuery conversation history

You can analyze the feedback data with
[BigQuery conversation history](https://docs.cloud.google.com/dialogflow/cx/docs/concept/export-bq.md.txt).

If you have already created your BigQuery table,
you can alter your existing table with the following SQL command if it doesn't have the required `bot_answer_feedback` column:

```sql
ALTER TABLE <your_dataset_name>.<your_table_name>
ADD COLUMN bot_answer_feedback JSON;
```

## Read feedback with the API

The conversation history resource contains
`answerFeedback` fields that contain feedback data.
See the `GetConversation` method in the RPC documentation.