Skip to main content

Amplitude integration

CommandBar’s integration with Amplitude works in two directions:

  1. CommandBar —> Amplitude: send CommandBar-generated events to Amplitude, so you can build dashboards using CommandBar events (and mix them with other events in Amplitude)
  2. Amplitude —> CommandBar: (a) use cohorts built in Amplitude for Who targeting in CommandBar; (b) use Amplitude userProperties and events for targeting in CommandBar.
One-time configuration

Once configured, the integration will "just work" — no maintenance required. You will not need to make any code changes to handle new/removed users that enter your synced cohorts.

Configuring Amplitude integration

  1. Navigate to Integrations and click “Connect” on the Amplitude card.

    Amplitude integration card

  2. To send CommandBar-generated events to Amplitude, set the toggle to “Send”.

    Amplitude send events toggle UI

  3. Take note of your API key and organization ID. You'll need these to enable the integration in Amplitude.

    Amplitude connect cohorts UI

  4. To finish syncing Amplitude cohorts, you’ll need to log in to Amplitude at https://analytics.amplitude.com/login.

Syncing Amplitude cohorts with CommandBar

  1. Inside Amplitude, click on "Data" in the top navigation menu.

    Amplitude admin UI to find Syncs

  2. Select "Catalog" in the left-hand menu.

    Amplitue cohort selection

  3. Select the "Destinations" tab, search for "CommandBar", then select the "CommandBar" card under "New Destinations".

    Amplitude add destination

  4. Give your integration a name, then fill in the API Key and CommandBar Organization ID with the values from the Amplitude configuration screen in app.commandbar.com from earlier.

  5. Select the field that maps to your CommandBar user id.

tip

The user ID should be the same ID or slug you pass into window.CommandBar.boot().

Amplitude add destination button

  1. Click save to enable the integration.

How to use Amplitude cohorts in CommandBar

There are many ways to use Amplitude cohorts in CommandBar, and we'll walk through a few!

Deploy a product tour to a specific cohort

If you want to target a product tour to a specific Amplitude cohort:

  • From the Product Tours dashboard, click into a product tour or create a new one.
  • Select the "Targeting" tab.
  • In the Audience dropdown select “Custom”.
  • Click "Add condition", open the first dropdown, and choose "Amplitude Cohort".
  • Then choose the desired Amplitude cohort.

Using a Amplitude cohort in a product tour

Deploy a checklist to a target cohort

If you want to deploy a checklist to a specific Amplitude cohort:

  • From the Checklist dashboard, click into a checklist or create a new one.
  • Select the "Targeting" tab.
  • In the Audience dropdown select “Custom”.
  • Click "Add condition", open the first dropdown, and choose "Amplitude Cohort".
  • Then choose the desired Amplitude cohort.

Using a Amplitude cohort in a checklist

What events are sent to Amplitude?

If enabled, these events are sent to Amplitude.

Using Amplitude data and events in CommandBar

You can (1) send Amplitude userProperties to CommandBar; and (2) send Amplitude events to CommandBar

Sending Properties to CommandBar

You can send any of the existing user properties that you send to Amplitude to CommandBar. 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 CommandBar when CommandBar starts:
window.CommandBar.boot(userID, userProperties)

// Or by adding one-off or session only properties to CommandBar is easy too:
window.CommandBar.addMetadata("userIsWorkspaceOwner", true);

Sending Events to CommandBar

You can also send events that are generated by Amplitude directly to CommandBar. This allows you to treat any Amplitude-generated event the same was as a natively-generated CommandBar event.

// Most companies using Amplitude have a globally available function
// to track events. The simplest way to ingest all events is to add a
// CommandBar SDK call to trackEvent to this function.

const reportEvent = (event, eventProperties) => {
amplitude.getInstance().logEvent(event, eventProperties);
CommandBar.trackEvent(event, eventProperties);
};

FAQs

How does this work? What pages will events be sent from?

Events generated by CommandBar will now flow to Amplitude from any page in your product where (a) CommandBar is booted and (b) Amplitude is installed.