Skip to main content

Sending data to a custom destination


If you are on the Enterprise plan, our analytics integrations can automatically set this up for you!

To send data to a custom destination, you’ll need to use an event subscriber. This is a function that will be called whenever a CommandBar analytics event is generated. Within the body of the function, you can filter the events to focus on the ones you want, and then send them to a data warehouse or analytics provider, or anything else.

Here’s an example of how to use .addEventSubscriber, and visit the SDK page addEventSubscriber for more info.

window.CommandBar.addEventSubscriber((eventName, eventData) => {
sendToCustombackend({ name: eventName, ...eventData });

Creating multiple event subscribers

Multiple event subscribers can be created when needed. For example, you could have one event subscriber to track analytics, and another event subscriber to close any other open modals in your app when Spotlight is opened.