The Botpress Cloud dashboard provides you with an Analytics page with counters for the total number of users, new users, returning users, sessions and messages. It also shows a chart with the data and allows you to filter by date range. While this interface is great for understanding reach and engagement in a glance, you may need more in-depth data about user behavior and the paths they take when interacting with the bot, and you may need to have this data streamed to a third-party service like Hotjar, Segment or Amplitude. Luckily, you can use the Hooks feature to do just that!. In this tutorial we’re going to use Mixpanel as an example, but you can use any service that has a REST API and an endpoint to receive events.Documentation Index
Fetch the complete documentation index at: https://botpress.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Setting up Mixpanel
- Create an account and a project in Mixpanel.
- Go to your project settings and copy the Project Token.
Setting up the Hooks
- Open Botpress Studio, go to the Hooks tab and click on the
+button next to Before Incoming Message to create a new hook. - Name it
send-user-analyticsfor example - Add the following JavaScript code:
- Click on the
+button next to Before Outgoing Message to create a new hook. - Name it
send-bot-analyticsfor example - Add the following JavaScript code:
NoteNow every time a user or the bot sends a message, Mixpanel will be notified with the event data. You can use this data to create funnels, analyze user behavior and understand the paths they take when interacting with the bot.