A session is a complete log of a conversation a user had with your bot. At the simplest level it's a record of the user questions that drive the conversation and the corresponding responses made by the bot. That reads like a script. But there's more to a session than just that. A session collects every detail of what happened from the begnning to the end of the conversation, telling not only how the bot responded, but also how the response was arrived at. Each session is logged with a unique session ID to make it easy to find in the Log Data Source viewer.

A session is made up of the following:

  • Session properties (id, beginTime, transactionCount and other information about the session)
  • Metadata
  • Global variables
  • A collection of all the transactions

Referencing session properties

TQL by itself does not know where to find the session properties, so when writing a query you have to add a session prefix to put the reference into perspective. For example, to access the session's ID, you would write or for short. The transaction count would be written as s.transactionCount and so on. A query to show all the session IDs along with the transaction count would look like this: listall, s.transactionCount. You can find out more about the different TQL commands on the command page in the Query Syntax section on the left.

Session properties

Session in session viewer

Some properties often used in queries are:

Property Description A unique identifier which is the key for a particular session
s.beginTime A timestamp telling when the session began
s.transactionCount The number of transactions during the session, including the greeting

Global variables

Global variables are generally logged as part of the transaction in which they changed. An exception to this are global variables that change during the End Dialog script, which is not associated with an actual transaction. This is a an easy way to set up queries for end values of important global variables. For example, let's say you counted the number of times a user input ran into the safety net. At End Dialog you save that variable to itself or to a new variable:

End dialog script to log a variable

In the LDS viewer the variable is listed as a global variable at the session level. Global variable in lds

Now in TQL you can pull out sessions in which the safety net became active only once, or run a distribution to find sessions with higher usage of the safety net. Please refer to the TQL Syntax Overview for the exact syntax to use in querying variables.

Was this page helpful?