Nothing Particularly Magnificent


    10.51.10 • Public • Published


    Analytics for Botpress provides an interface to view graphs and data of your chatbot typical usage. By using this module, you can have a look to your total users, retention, daily active users, busy hours and a lot more...


    npm install --save @botpress/analytics


    This module has some built-in analytics available from the box but also allows you to set up your own custom analytics.

    For latter you need to:

    1. Register graphs by calling
    2. Calling, count=1) and, count=1) to register events that get displayed in analytics accepts an object with following keys:

    • name (String)
    • type (one of 'count', 'countUniq', 'percent', 'piechart', 'table')
    • description (String)
    • variables ([String]),
    • fn: (Function that is used to calculate result)
    • fnAvg: (Function) => that gets used for 'percent' type to calculate average value


    If you need some statistics about the satisfaction of your users, you can create 3 graphs : 2 counts and 1 table.

    Read events

    To generate your graphs, create a new file inside src folder called analytics.js. Inside this file, call the addGraph() function :

    module.exports = async bp => {{
            name: '😃 users',
            type: 'count',
            description: 'Happy users',
            variables: ['happy']
            name: '😕 users',
            type: 'count',
            description: 'Mad users',
            variables: ['mad']
            name: 'Unsatisfied reasons',
            type: 'table',
            description: 'Why your users are mad?',
            variables: ['reason']

    and then you can call the analytics.js file inside the index.js file :

    const registerAnalytics = require('./analytics')
    module.exports = async bp => {
        // ...
        // register functions
        // ...
        await registerAnalytics(bp)

    Send events

    To send events, create nodes that passes inside functions that calls the botpress customs analytics functions :

    Examples of functions inside the actions.js file :

    module.exports = {
        userIsHappy: async (state, { bp, user }, params) => {
        userIsMad: async (state, { bp, user }, params) => {
        satisfactionReason: async (state, event, { bp, user }) => {

    For more details, please read the documentation.


    botpress-analytics is licensed under AGPL-3.0


    npm i @botpress/analytics

    DownloadsWeekly Downloads






    Unpacked Size

    5.9 MB

    Total Files


    Last publish


    • laurentlp
    • samuelmasse
    • slvnperron
    • spgingras
    • franklevasseur