Explore session statistics

Once you've launched a bot, the top question in your mind will be how many people are chatting with it. How long are the conversations? Which questions are users asking most often? This section describes some ways that you can query volume of usage, whether for the entire bot, or for particular flows in your bot. There are countless variations of the kinds of information you can query. Here we'll show you just a few possibilities, and leave it to you to explore more of what you can do.

For additional ideas of what you can query, pleases check the TQL cookbook.

General usage statistics

One of the basic queries you'll need is to check the amount of traffic your bot receives. Remember the date transformers we showed you on one of the previous pages? There we had a query to deliver a detailed report of bot usage per day, broken down by hour. We'll revisit that to set up this more general query, the amount of traffic per day:

d date:  catd(model="date") s.beginTime as date order by date

This query displays the date and the number of sessions that occurred on that day.

There may be some noise in this though, because we don't know whether users actually engaged with the bot. They may have started a session, but never followed up with an actual question, for example, just by navigating to the Website. The bot greets visitors and encourages them to ask a question. This counts as the first transaction. Until we had a subsequent transaction with an actual user input, we may not be interested in that session. The following query shows the sessions that had at least one question after the session began. What we will not see are 1) sessions in which the user did not respond to the greeting and 2) sessions in which the user only hit enter, sending empty inputs.

d date:  catd(model="date") s.beginTime as date, t.e.userInput!="" order by date

The query results will look something like this, depending on usage: usage statistics

The results of the second query will likely show fewer actual sessions, but these are the sessions that will be most interesting to examine, because it's in these that users engaged with the bot with their questions.

Number of interactions per session

We measure the length of a session by the number of transactions (interactions). Are users having long conversations with your bot, or do they ask a single question, receive the answer, then end the exchange? Keep in mind that short conversations are not necessarily a sign of poor quality. If users quickly receive an answer to something that was blocking them, then continue with whatever they were doing, it's quite a good sign. Try this query to find out the distribution of session length:

d s.transactionCount as interactionCount order by interactionCount

This distribution shows you a list of the number of transactions, followed by a count of how many sessions contained exactly that amount of transactions.

If you wish to examine sessions of a certain length, you can call up the session IDs as follows, in this case sessions with two transactions containing one actual question.

la s.id: s.transactionCount == 2, t.e.userInput !=""

Alternatively, you may want to list those sessions in their entirety (the questions and answers), such as with this query, for all chats with four transactions or less:

la t.id, t.e1.userInput as userInput, t.e2.answerText as botResponse: s.transactionCount < 5

Or try the same query with an additional refinement of omitting the first transaction, which only shows the bot's greeting:

la t.id, t.e1.userInput as userInput, t.e2.answerText as botResponse: s.transactionCount < 5, t.index != 0

There are many variations to these queries that you can use to perform exploration into the kinds of sessions your bot had. Feel free to experiment!

What are the top Flows

You know your bot is heavily in demand. Users are chatting, and even asking several questions per conversation. You definitely will want to know what exact questions they asked. What are the main intents users try to resolve by using the bot. Try this query to view the top flows that users triggered with their questions.

d t.e.fname :
    t.e.pathType=="flow-trigger" 
order by count desc

Using the Longberry Baristas solution you may see a result like this: frequent flows

If you want to take this further, you can check the high volume flows to see if they are overtriggering. A query to display the user input that triggered the flow is all you need:

lu t.e1.userInput: t.e2.fname == "Name of your flow here"

Was this page helpful?