Skip to main content

Setting the dialog result

During the conversation with the client, it may be necessary to record the dialog result. Based on such results, you will be able to identify script weaknesses and fix them, as well as estimate conversion rates.

Aimylogic provides the $analytics.setSessionResult method that allows you to set dialog results. You can track them in project statistics.

How to use

Identify the key points of your script and set them via $analytics.setSessionResult in the Code block.

Calling the setSessionResult method

The method accepts a string surrounded by single or double quotes.

Usage details

  1. If $analytics.setSessionResult was called more than once during one session, only the last result will be recorded.

  2. You can use the method for both chatbots and call campaigns.

Where can I see dialog results

The dialog result will appear on the chart in Statistics → Results as soon as the client enters the script section where the result is set.


Let’s create a script in which the bot requests feedback from the client.

  1. Create a screen with the Text block and insert “Please, help us improve our bot! Did you find everything you were looking for?”.
  2. Add the Yes and No buttons to the screen.
  3. Create another screen with the Code block and call the $analytics.setSessionResult method. Pass the Positive feedback string as the argument.
  4. Add the Text block to this screen and paste “Thanks for your feedback. We are happy to help you!”.
  5. Connect the Yes button with this screen.
  6. Repeat the steps 3−4. This time, pass Negative feedback into $analytics.setSessionResult, and paste “We are really sorry that couldn’t help you. How can we improve our service?” in the Text block.
  7. Connect the No button with this screen.
  8. To catch any client phrase, add the global $TEXT intent to this screen.
  9. Create one more screen with the Text block and paste “Thanks! We will take your feedback into account.”.
  10. Connect the global intent to this screen.

You will get the script as follows:

Recording results in the script

Positive feedback or Negative feedback will be displayed in the Results chart, depending on the button chosen.

Add such a survey to your script and improve it by saving the feedback to Google Sheets.