Use Segment to trigger studies and collect user and event data without the need to install the Sprig SDK. Send your Sprig user insights to any Segment-connected app.

You can use Segment to trigger studies and collect user and event data - configuring Segment as a source and Sprig as the destination. You can configure Segment as a source to forward events and attributes to Sprig. For example, you can use Segment to:

  • Send custom events and page visits to Sprig
  • Send User IDs and other attributes to Sprig
  • Trigger a Sprig study

You can also send your Sprig user insights to any Segment-connected app - configuring Sprig as a source and Segment as the destination.

The next section will describe the steps you need to take to use Segment as a source.

Segment as a Source, Sprig as a Destination.

There are two steps to this task, 1) creating or locating a source of the Segment events, and 2) adding Sprig as a destination. If you have not created a Segment source before, Segment provides help here.

Segment Source Features Supported by Sprig

In addition certain Segment sources and frameworks support the transfer of different data types to Sprig. The following table shows the Segment sources and events supported by Sprig. For example, the table shows that only the Actions Destination Framework supports using Segment events to trigger Sprig studies. However, support for events as triggers from mobile sources is coming soon.

The next section will describe configuring Segment as a Source.

Feature \ Destination Framework



Source: JavaScript



Source: iOS



Source: Android



Source: React Native



Events as Triggers

:white-check-mark: (JavaScript only)


Events as Filters



Events: Track, Identify, Alias



Connecting Segment to Sprig

  1. In Segment, click Connections, then click Sources.

  2. Click the Source you want to use Sprig as a Destination.

  3. Click Add Destination.

  4. In the Filter Destinations field, type Sprig.

  5. Click on Sprig, then click Configure Sprig.

  6. Give the Destination a name.

  7. Select an existing JavaScript website source to connect to Sprig (Actions).

  8. Find your Environment ID on Sprig Dashboard > Connect > JavaScript. Use the Development Environment ID for a testing environment and the Production Environment ID for your live website environment. When you configure the Destination, input the appropriate Environment ID.

  9. Select Quick Setup to start with pre-populated subscriptions or Customized Setup to configure each action from scratch. Click Configure Actions to complete setup.

After the Sprig (Actions) destination has been installed, your JavaScript website source will automatically initialize the Sprig SDK when Segment is initialized. Then, based on your configuration, Segment Identify, Track, and Alias events can be forwarded to the Sprig SDK without needing to add Sprig-specific code to your website.

Validating your Setup

Segment - Identify

If you’re not familiar with the Segment Specs, take a look to understand what the Identify method does. An example call would look like:

analytics.identify('userId123', {
  firstName: 'James',
  lastName: 'Gibbon'

Open the web page or app in your browser and run this command in your web console . In Segment, go to the corresponding source and click Debugger. You should see something similar to the following:


Validating Identify

Once Identify events are being triggered in your users' browsers and successfully forwarded to Sprig, you will be able to view visitors being created on your Sprig People dashboard. You'll be able to see visitor emails if being set, and when clicking on a specific visitor, you'll be able to see their User ID as well as any attributes that were set for them.

Segment - Track

More information on the Track method can be found here. An example call would look like this:

analytics.track('Clicked Button')

Use Track calls to track events and use them as filtering criteria for your studies, or to trigger studies. If, when a Track event is recorded, a study is in progress with that event as its trigger, and the current user matches any filtering criteria, the study will be triggered for the user. At this time, Sprig does not support event properties, so for best results, use Segment event names that are descriptive enough to filter your studies.

Create Events in your Sprig Events dashboard and map them to your Segment Track event names before you start sending Segment data to Sprig.



analytics.track('Clicked Button') can only be used as a Study trigger when using Actions Destination Framework with JavaScript as the Source.

Validating Track

Once Track events are being triggered and successfully forwarded to Sprig, you will be able to view events in the Sprig app. The Daily Usage column, under the Web platform when hovering over the icon in each row.

Segment - Alias

For more information on Segment Alias, take a look this. An example call would look like this:


Sprig as a Source, Segment as a Destination.

Perhaps you want to send data from Sprig to Segment whenever a study response is collected? That data could then be exported one or more of Segment's Destination integrations.

There are two steps to this task, 1) creating the Sprig Source, and 2) adding a Segment destination.

Sprig as a Source Features Supported by Segment

Sprig supports Sending study responses collected in Sprig to Segment each time a response is received.

Connecting Sprig to Segment

  1. Sprig currently does not appear as a Source in Segment, but you can set a HTTP endpoint as a source in Segment’s workspace to receive Sprig’s data as a stream. In Segment, click Connections, then click Sources.
  2. Search for HTTP in the Sources Catalog and click Add Source.
  3. Next type in a Source a name. As well as project specific labels, consider incorporating the Sprig production and development environments in your naming convention.
  4. Type in URL of your website and click Add Source.
  5. Click Copy Snippet and paste the code so that it is referenced in the section of all the pages that can display Studies.
  6. Click Settings and API Keys.
  7. Click Copy next to Write Key.
  8. In the Sprig app, click Connections. Under Sources, click on Segment Stream.
  9. Click Add Key and paste the Write Key into the field.
  10. Click Save.
  1. Returning to the Source you just created in the the Segment app, click Overview > Add Destination and follow the steps for creating a destination where you'd like to send study response data.

Troubleshooting installation

The Segment Write Key is unique to each source connected to Segment, so please check to make sure you add the right one, and that the environment in the Sprig Connect page in which the Write Key is set matches the Segment Source for that Write Key. For example, a source for your app's Production environment should be added in Sprig's Connect page viewed in Production.

A User ID is required to receive Sprig data in Segment. Sprig cannot send a response to Segment if the study taker is anonymous: if the visitor does not have a User ID.

Integration data fields

This table describes the data that will be sent from Sprig's Segment Stream to your destination integrations.



userId (required)

Also known as externalUserId, userId is required by the Segment Stream. This value should be consistent across all data flowing through Segment (more details)


Name of the action that a user has performed. We will use SDK - Submitted - Survey Response as a default value


Name of the survey


Uuid of the survey


Timestamp when the survey was created (ISO-8061 format)


Question text


Question type


Uuid of the visitor who submitted the response


[deprecated] Legacy identifier of a visitor. Different from visitorId (uuid), oldVisitorId is a number


A response group is a set of responses for a visitor for a given survey


The survey response to the question

Visitor's email


Other attributes of the visitor, like plan, company, role etc.


The label of the event that triggered this survey. Can be NULL


Dictionary of extra information that provides useful context about a message. Each call is required to contain a context.integration object in the call body that identifies where the call is coming from


Timestamp of when a message is sent to Segment


Automatically set by Segment, the timestamp of when a message is received by Segment


Timestamp when the message itself took place, defaulted to the current time by the Segment Tracking API, as a ISO-8601 format date string


Type of message, corresponding to the Segment API method: identify, group, track, page, screen, or alias. Sprig will call Segment’s track API to publish the events to destinations, so the type will be track