Segment integration: send Userflow events to Segment and receive data from it

Prev Next

The Segment integration lets Userflow work as both a Segment source and a Segment destination. As a source, Userflow streams its events into Segment so they can be forwarded to your other tools. As a destination, Segment sends user attributes and events from your other sources into Userflow.

Setting up the Segment integration has three parts. Do them in this order:

  1. Set up the Segment integration in Userflow

  2. Add Userflow as a source in Segment

  3. Add Userflow as a destination in Segment

Why does the Segment integration use an HTTP API source and webhooks?

Segment stopped accepting new web plugin integrations in late 2019, so Userflow can’t appear as a regular Segment integration. Instead, the Segment integration uses Segment’s standard HTTP API source and Webhooks destination. This also means you install Userflow.js in your front end yourself; Segment doesn’t load it for you.

We recommend a dedicated HTTP API source for Userflow. Don’t reuse its Segment Write Key for anything else.

Do I need a separate Segment integration for Staging and Production?

Yes. Each Segment integration connects one Userflow environment to one Segment source and destination. Use separate Segment sources and destinations for each of your Userflow environments, such as Production and Staging, so Staging data doesn’t mix with Production data.

If you have both, complete all three parts once for each. We strongly recommend connecting Staging first and checking that it works before you connect Production.

Use the same user ID in Segment and Userflow

The Segment integration matches users by user ID. Identify each user with the same ID in Segment and in Userflow, or the data won’t line up.

Set up the Segment integration in Userflow

  1. Sign in to Userflow and switch to the environment you want to connect to Segment.

    Environment picker in Userflow

  2. Go to Settings → Integrations and click Add integration.

    Add integration button in Userflow Settings → Integrations

  3. Find and click Segment in the list.

    Segment in the Userflow integrations list

  4. Click Add Segment.

    Add Segment button

    If you don’t see Add Segment, the integration may not be included in your plan. Check your billing settings.

When this is done, continue with Add Userflow as a source in Segment.

Add Userflow as a source in Segment

Adding Userflow as a Segment source streams Userflow-generated events, such as Flow Started and Checklist Task Completed, into Segment. Set up the Segment integration in Userflow first.

  1. Sign in to Segment and click Add Source.

    Add Source in Segment

  2. Search for and click HTTP API.

    HTTP API source in the Segment catalog

  3. Click Add Source.

    Add Source button for the HTTP API source

  4. Give the source a name, such as “Userflow”, and click Add Source.

    Naming the HTTP API source

  5. Copy the Write Key.

    Write Key for the HTTP API source

  6. In Userflow, go to Settings → Integrations → Segment. Paste the Write Key into the Segment Write Key field and click Save.

    Segment Write Key field in Userflow

  7. Click the Stream events from Userflow to Segment switch and confirm in the dialog.

    Stream events from Userflow to Segment switch

  8. Streaming starts immediately.

    Event streaming turned on for Segment

  9. In Segment, open the Debugger tab and check that Userflow events are coming in. They usually appear within a few seconds.

    Userflow events in the Segment Debugger

When this is done, continue with Add Userflow as a destination in Segment.

How do I stop streaming Userflow events to Segment?

  1. In Userflow, go to Settings → Integrations and open Segment.

  2. Check the Stream events from Userflow to Segment switch. Gray means streaming is already off. Green means it’s on.

  3. Click the switch and confirm in the dialog.

Event streaming to Segment stops immediately.

Add Userflow as a destination in Segment

Adding Userflow as a Segment destination sends user attributes and events from your other Segment sources into Userflow. Set up the Segment integration in Userflow first.

  1. Sign in to Userflow, go to Settings → Integrations → Segment, and copy the Webhook URL.

    Webhook URL in Userflow’s Segment settings

  2. Sign in to Segment and click Add Destination.

    Add Destination in Segment

  3. Search for and click Webhooks.

    Webhooks destination in the Segment catalog

  4. Click Configure Webhooks.

    Configure Webhooks button

  5. Select the sources you want to send to Userflow. Usually this is a separate source for your back end.

    Selecting sources for the Webhooks destination

  6. Click Confirm Source.

    Confirm Source button

  7. Click Webhooks.

    Webhooks settings for the destination

  8. Paste the Webhook URL from Userflow into the Webhook URL field and click Save.

    Webhook URL field in the Segment Webhooks destination

  9. Click the toggle to turn on the destination.

    Turning on the Webhooks destination

  10. In Userflow, go to Users and check that users and events from Segment are coming in.

Send company events from Segment to Userflow

This only applies if you use companies in Userflow.

Segment doesn’t link events to companies directly. A common workaround is an event property that names the company, such as company_id or workspace_id. Userflow can read that property and attach each event to the right company.

  1. Sign in to Userflow and go to Settings → Integrations → Segment.

  2. Enter the name of your company event property and click Save.

    Company event property field in Userflow’s Segment settings