$analytics.setSessionResult
The method sets the conversation result that you can track in the dialog statistics report.
Syntax
The method accepts a string as the only argument.
$analytics.setSessionResult("Conversation result")
The conversation result will be displayed in the Project overview > Results and Analytics > Dialogs sections.
Usage details
-
If
$analytics.setSessionResult
was called more than once during one session, only the last result will be recorded. -
In the telephone channel, you can also use the
$dialer.setCallResult
method to set the conversation result.
In the test widget, $analytics.setSessionResult
is not supported.
How to use
In the example script below, the bot requests feedback from the client.
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.