Help with implementing Custom Tracker Store

Hi there, I am trying to create a Custom Tracker Store so that I can log each interaction with my chatbot through a third party API.

I have read but I don’t understand the following:

  1. How to extend the TrackerStore base class

  2. Where to put my file that extends the TrackerStore base class

  3. How to set the store_type in endpoints.yml to be the path to my module Class

Please can somebody show me examples of the above?

Many thanks


I’m also in the process of writing a custom tracker. Here are the steps I’ve gone thru:

  1. Copy the existing rasa which is in github here.

  2. Let’s call the new file and place in the project root directory. Edit your copy of the standard tracker_store. Remove all of the class definitions except one that you’ll model your tracker after (I’m using the MongoTrackerStore as my template). You’ll have to add in a reference to the TrackerStore by inserting this at the top of your file: from rasa_core.tracker_store import TrackerStore

Hack away on your copy of the MongoTracerStore, let’s say you’ve called your copy of the class MyTrackerStore.

Throw a logger message at the beginning of your init function so you know that it’s been invoked when the Core starts.

  1. Based on the settings above, the endpoints.yml entry will look like this:
    store_type: myTracker.MyTrackerStore
    url: localhost

I have my custom tracker store working and realized there I forgot to mention the requirement of the url parameter as stated in the docs. If you’re copying the existing MongoTrackerStore as your template, you must add a url parameter to the class __init__ call.

Hi @stephens have you create a custom tracker code?

1 Like

Hi Greg,

Is your example maybe available? it could be useful (for not python programmers like me) to have a shared example of a custom tracker store. My proposal is a FileStore just to store “chat history” as flat file system log files! BTW, see also my previous question here.

Thanks/ giorgio

Hi Giorgio,

That example was from my prior employer and is not publicly available. I am now at Rasa but you can use the existing to get started. You would pick the class for the tracker store you are currently using or override the save method for that store.

However, I would no longer take this approach to create a logfile of the tracker events. Instead, you can use the default RabbitMQ service to create the store. I did this for a recent personal project of mine and described it in a blog post here.


1 Like

Thanks @stephens for the link to your interesting blog. Yes, the RabbitMQ could be a convenient option for high traffic scenario.

I feel the original @andymayer request is a very common need for any (beginner) RASA developer and the lack of any conversations logging feature, perplex newbies (like me).

So Ok, one could:

  • instantiate a custom Tracker class,
  • or get tracker data feed via a message queue as you suggest (maybe optimal in case of really heavy traffic, to split logging from the engine load,
  • or log externally (easy to do if client application interfaces RASA through RASA Core REST APIs, by example). Also, one could use RASA X to do nice analytics!

But my praise to RASA team is to supply ready-made simple log file option for the rasa run server. Just as a baseline.

Makes sense?


Hey I have implemented this custom tracker for the firestore.

check it here Custom Tracker to save conversation history into Firebase Firestore

This approach is not working for me :frowning:

I followed the exact same approach you mentioned. Btw, I am using python 3.6 and rasa 2.8.12.

Basically, the tracker stored in the mongodb does not have a history of the actions, which is causing the contextual flow to break.

The tracker store does contain a history of the actions run for each session.

@stephens the link you shared for a blog post seems to be not found. It loads a 404 error.

The post is now here

Thank you @stephens . I was trying to implement a custom tracker store using Couchbase as the DB. Being a novice, I’m finding it very difficult. Any advice or reference as to how to proceed in this situation?

I don’t have much to add beyond my post above, Since Couchbase is a NoSQL db, I would start by copying the Mongo class which is here.