$analytics.setSessionResult
This method records the final result of the dialog. For example, this can be service feedback left by the user.
There can be only one result in a session. To record intermediate results and other actions in the dialog, use the setScenarioAction
method instead.
tip
You can find statistics on dialog results on the chart in the Project overview section and in the dialog report. You can create and edit session results in the Metrics configuration section.
Syntax
The method accepts a string as an argument.
$analytics.setSessionResult("Dialog result")
Usage details
- Only the last result will be recorded if the method is called more than once during one session.
- In call campaigns, you can also use the
$dialer.setCallResult
method to set the dialog result.
How to use
In the example script below, the bot requests feedback from the user:
state: SatisfiedClient
a: Please, help us improve our bot! Did you find everything you were looking for?
state: HappyClient
intent: /yes
a: Thanks for your feedback. We are happy to help you!
script:
$analytics.setSessionResult("Positive feedback");
state: UnhappyClient
intent: /no
a: We are really sorry that we couldn’t help you. How can we improve our service?
script:
$analytics.setSessionResult("Negative feedback");
# ...
When entering the HappyClient
or UnhappyClient
state, Positive feedback or Negative feedback will be displayed in the Session result column respectively.