Analytics functions

The functions in the bot.analytics namespace are used to send data to analytics platforms such as Mixpanel.

You must have configured a Mixpanel integration to use these functions.

updateUserProfile​(data)

Send additional attributes to a Mixpanel user profile. 

Property Type Description
data Object An object containing the additional attributes to send to Mixpanel as key-value pairs. If a key matches an existing property for that user profile, it will be overwritten with the new value.
 // Data object to send
 let data = {
   likesCheese: true,
   favouriteColour: "green",
 };

//Send the update
 bot.analytics.updateUserProfile(data);
 done();

For more information on Mixpanel user profiles, see the Mixpanel documentation.

sendCustomEvent​(name, data)

Send a custom event to Mixpanel.

Property Type Description
name string The name of the custom event to send.
data Object An object containing the event attributes to send to Mixpanel as key-value pairs.
 // Data object to send
 let data = {
   item: "Red shows",
   qty: 2,
 };

//Send the update
 bot.analytics.sendCustomEvent("Purchase", data);
 done();
Was this article helpful?
0 out of 0 found this helpful