More types of graphs for custom analytics

I noticed that there are only four graph definitions. Isn’t this too basic. I can imagine many scenarios where data visualization would be way better if other graph types could be included. For instance, a count unique bar graph to complement the pie chart which can take an array of unique metric instances and display them as a grouped bar graph with values as below:
Or any other similar implementations. I am sure these are already supported seeing that out of the box analytics appear on other types of graphs (heat-maps, line graphs etc). Any pointers on resources for including more graph types are most welcome.

Hey @DigiSenseiZim !

I understand that you would like to see more types of graphs in the the Custom Analytics feature of Botpress.

What specific types of graphs would you like to see? Also, what would be your use case for these new types of graphs? Your answer will help us guide our decisions to improve the Custom Analytics.

Thanks for your feedback!

1 Like

Hie @spgin

Type: Heat map
Use: For example, to see concentration of customers in certain location

Type: Comparative Count Unique bar/line graph
Use: Lets say we have a metric called feedBack. Within that metric we have the groups feedBack~Excellent ; feedBack~Average and feedBack~Poor

We can more easily analyse trends with a graph like below i.e. a line graph which takes the array of all/some groups that make up a metric

instead of


which looks constipated

So simply put we need more compound graph types where metrics can be placed on one graph for better data visualisation. I know we have a pichart but lets expand on that a little.

And also when I restart Botpress I have to run a flow to set metrics all over again. Fair enough that the data for increments/decrements from the last sessions is safe but I think you can change the builtin code a bit to account for this

I would really love to open pull requests and share my workarounds but problem is I mix up languages to a superlative degree so my code would never get approved

@DigiSenseiZim, Please suggest me, how to get number of users in the botpress,

I used the Custom Analytics, but it is showing ‘0’ users in all graph

Please suggest me, how to set a metrics and how to get users count.

Would be useful if I could see your hooks / knex query and all other code you wrote. Also user is a very broad term and by default the analytics module ships with number of users



const axios = require(‘axios’)

const registerCustomAnalytics = async () => {
const axiosConfig = await bp.http.getAxiosConfigForBot(botId)
const countGraph = {
name: ‘Total Users’,
type: ‘count’,
description: ‘Total number of users’,
variables: [‘user-type’]
const countUniqGraph = {
name: ‘Total Customers’,
type: ‘countUniq’,
description: ‘Total number of customers’,
variables: [‘user-type~customer’]
const percentGraph = {
name: ‘Percentage of visitors’,
type: ‘percent’,
sumValues: true,
description: ‘Percentage of visitors / total users’,
variables: [‘user-type~visitor’, ‘user-type’]
const pieChart = {
name: ‘Percentage of users per type’,
type: ‘piechart’,
description: ‘Percentage of users per type’,
variables: [‘user-type’]
}’/mod/analytics/graphs’, countGraph, axiosConfig)’/mod/analytics/graphs’, countUniqGraph, axiosConfig)’/mod/analytics/graphs’, percentGraph, axiosConfig)’/mod/analytics/graphs’, pieChart, axiosConfig)


return registerCustomAnalytics()

“use strict”;

I have just uncomment code , has explained in the