Segment

Prev Next

Segment is a data platform that lets you connect data sources with data destinations.

With the Userflow-Segment integration, Userflow can work both as a Segment source and a Segment destination. This way you can get events from Userflow forwarded to other data destinations, and get user attributes and events from other event sources forwarded to Userflow.

Quick note about the Segment integration

Since Segment has restricted new Web Plugin integrations since late 2019, the Userflow-Segment integration has been improvised. It requires you to independently install Userflow.js in your front-end and utilize standard HTTP API sources along with Webhooks destinations. We apologize for any inconvenience this may cause. If you share our concerns regarding this matter, we encourage you to contact Segment and advocate for the inclusion of support for Userflow.

Segment sources/destinations and Userflow environments

It’s recommended to use a separate Segment source/destination for each of your environments (Production, Staging). The same is true in Userflow. This is to ensure that, for example, Staging data doesn’t contaminate Production data.

A Userflow-Segment integration is between a single Userflow environment and a single Segment source/destination. If you have both a Staging and a Production environment, you therefore have to run the setup guides below for both Production and Staging.

We strongly recommend that you start with your Staging environment and verify that it works as you expect before connecting your Production environment.

We also recommend using a dedicated HTTP API source for Userflow, and to not use the same Segment Write Key for other purposes.

Required User ID match for integration

To match data between users in Segment and Userflow it is a requirement that you use the same user id to identify users in both platforms.

Setup guide

The setup consists  of 3 parts:

  1. Set up the Segment integration in Userflow  

  2. Add Userflow as a source in Segment

  3. Add Userflow as a destination in Segment  

First, you’ll need to add the Segment integration in Userflow.

Set up the Segment integration in Userflow

  1. Sign into Userflow and navigate to the environment you want to integrate with Segment:  

Go to environment

  1. Go to Settings -> Integrations. Then click Add integration:  

Add integration

  1. Find and click Segment in the list:  

Find Segment

  1. Click Add Segment (activate/upgrade your plan if you don’t yet have access):  

Add Segment

Next, let’s add Userflow as a source in Segment.

Add Userflow as a source in Segment

To make Userflow continuously stream Userflow-generated events, such as Flow Started and Checklist Task Completed, into Segment, we’ll set up Userflow as a source in Segment.

Make sure you’ve set up the Segment integration in Userflow first.

Setup guide

  1. Sign in to Segment and click Add Source:  

Go to sources

  1. Search for and click HTTP API:  

Select HTTP API

  1. Click Add Source:  

Click Add Source

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

Give it a name

  1. Copy the Write Key:  

Copy key

  1. Sign in to Userflow and navigate to Settings -> Integrations -> Segment. Paste the Write Key that you copied from Segment in step 3 into the Segment Write Key field and click Save:  

Paste key

  1. Click the Stream events from Userflow to Segment switch and confirm in the dialog that appears:  

Enable event streaming

  1. Event streaming will start immediately:  

Done

  1. Go back to Segment, click the Debugger tab, and verify that Userflow events start showing up. It usually only takes a few seconds for Segment to show them:  

Debugger

Finally, let’s add Userflow as a destination in Segment.

Stopping the integration

  1. Find your Segment integration in Userflow under Settings -> Integrations.  

  2. If the Stream events from Userflow to Segment switch is gray, then it’s already stopped. If it’s green, then it’s currently running.  

  3. Click the Stream events from Userflow to Segment switch and confirm in the dialog that appears.  

  4. Event streaming will stop immediately.

Add Userflow as a destination in Segment

To make Segment forward user attributes and events from other data sources into Userflow, we’ll set up Userflow as a destination in Segment.

Make sure you’ve set up the Segment integration in Userflow first.

Quick note about the Segment integration

Because Segment has been blocking new Web Plugin integrations since late 2019, the Userflow-Segment integration is a bit ad-hoc. It requires you to install Userflow.js separately in your front-end, and use plain HTTP API sources and Webhooks destinations. For that, we’re sorry. If you’re as frustrated about this as we are, please go bother Segment about it and tell them to open up for Userflow :)

Setup guide

  1. Sign in to Userflow and navigate to Settings > Integrations > Segment. Copy the Webhook URL:  

Copy webhook url

  1. Sign in to Segment and click Add Destination:  

Go to destinations

  1. Search for and click Webhooks:  

Find Webhooks

  1. Click Configure Webhooks:  

Click Configure Webhooks

  1. Select any sources you want to stream to Userflow. You’ll typically want to have a separate source for your back-end, which you can select here:  

Select source

  1. Click Confirm Source:  

Click Confirm Source

  1. Click Webhooks:  

Click Webhooks

  1. Paste the Webhook URL that you copied from Userflow into the Webhook URL field and click Save:  

Add integration

  1. Click the toggle switch to enable the destination:  

Add integration

  1. Go back to Userflow, go to the Users tab, and verify that users/events from Segment start showing up.  

Adding support for company events

This is only relevant if you have Userflow’s Companies feature enabled.

Segment does not directly associate events with companies. A common workaround is to use an event property to indicate the related company (examples: company_id, workspace_id etc.). Userflow can extract this event property and associate events with the right company in Userflow.

  1. Sign in to Userflow and navigate to Settings > Integrations > Segment. Enter the name of your company event property and click Save:  

Company event attribute name