Amplitude integration
Command AI's integration with Amplitude works in two directions:
- Command AI —> Amplitude: send Command AI-generated events to Amplitude, so you can build dashboards using Command AI events (and mix them with other events in Amplitude)
- Amplitude —> Command AI: use Amplitude
cohorts
as audiences within Command AI
Once configured, the integration will "just work" — no maintenance required. You will not need to make any code changes to handle new properties.
Sending Command AI events to Amplitude
Navigate to Integrations and click Enable on the Amplitude integration card.
Set the toggle to Send and click Next.
Using Amplitude cohorts in Command AI
This integration allows you to use Amplitude cohorts as [audiences] within the Command AI editor.
- In Amplitude Data, click Catalog and select the Destinations tab.
- In the Cohort section, click CommandBar.
- Click Add another destination.
- Copy and paste the Org Id and API key into Amplitude.
- Map the Amplitude User ID field to the Command AI User ID field
- Save when finished.
You can find more details in the Amplitude doc.
Using code to send Amplitude user properties and events to Command AI
With a little code, you can (1) send Amplitude user properties to Command AI; and (2) send Amplitude events to Command AI.
Sending Properties to Command AI
You can send any of the existing user properties that you send to Amplitude to Command AI. Here’s a simplified code snippet:
// Your existing user properties
var userProperties = {
plan: "pro",
role: "admin",
...
};
// Passed to Amplitude
amplitude.getInstance().setUserProperties(userProperties);
// And additionally sent to Command AI when Command AI starts:
window.CommandBar.boot(userID, userProperties)
// Or by adding one-off or session only properties to Command AI is easy too:
window.CommandBar.addMetadata("userIsWorkspaceOwner", true);
Sending Events to Command AI
You can also send events that are generated by Amplitude directly to Command AI. This allows you to treat any Amplitude-generated event the same was as a natively-generated Command AI event.
// Most companies using Amplitude have a globally available function
// to track events. The simplest way to ingest all events is to add a
// Command AI SDK call to trackEvent to this function.
const reportEvent = (event, eventProperties) => {
amplitude.getInstance().logEvent(event, eventProperties);
Command AI.trackEvent(event, eventProperties);
};
FAQs
What pages will events be sent from?
Events generated by Command AI will now flow to Amplitude from any page in your product where (a) Command AI is booted and (b) Amplitude is installed.