Segment Web

Leverage your Segment web integration to trigger studies and collect user and event data without integrating the Sprig SDK.

📘

Info

This version of Segment's integration with Sprig works with Segment events sent with Segment's client-side, JavaScript integration for web browsers.

For mobile platforms, or events on Segment's cloud integration, use the Segment Cloud integration.

To send study response data into Segment, as a source to forward to other destinations, see Segment Stream.

Supported Capabilities

  • Send custom events and page visits to Sprig from your website
  • Send user identifier and attributes from your website
  • Showing a study on your website

Capabilities requiring Segment Cloud integration

  • Send custom events and page visits from your mobile application or cloud Segment integration
  • Send user identifier and attributes from your mobile application or cloud Segment integration

Capabilities requiring the Sprig SDK

  • Showing a study on your mobile application

Segment Web and Segment Cloud Comparison

In addition to this integration, Sprig has another integration to import data from Segment, Segment Cloud, specific to the Segment client-side, JavaScript integration for web browsers. The Segment Cloud integration can be used with mobile or cloud Segment sources, but cannot be used to install Sprig or show studies on your website.

We recommend using this Segment Web integration with web browser-based Segment sources to import events and user attributes, install the Sprig SDK, and show studies, while using the Segment Cloud integration to import events and user attributes from mobile and cloud sources.

To avoid duplicate events being created in Sprig, ensure that for each Segment source, the Segment Web integration (called Sprig (Actions) on Segment's platform) and the Segment Cloud integration (called UserLeap on Segment's platform) are not both enabled at the same time.

Best practices for sending Segment events

When connecting Segment to Sprig, it is recommended to filter events and only send events that you're planning to use as filters or triggers for your studies. This can be done within Segment, by setting up destination filters to choose which events should be sent over to Sprig. You can always modify your filters to add additional events, as needed.

Connecting Segment to Sprig

On Segment's platform, this integration is a destination called Sprig (Actions).

  1. From the Segment web app, click Catalog, then click Destinations.
  2. Use the navigation on the left to locate and select Sprig (Actions).
  3. Click Configure Sprig (Actions).
  4. Select an existing JavaScript website source to connect to Sprig (Actions).
  5. 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.
  6. 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.

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'
});

Use Segment’s Identify method to identify your users in Sprig. Segment traits map to Sprig attributes.

Validating Identify

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

Segment - Track

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

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.

Validating Track

Once Track events are being triggered in your users' borwsers and successfully forwarded to Sprig, you will be able to see event usage being tracked on your Sprig Events dashboard, in the Daily Usage column, under the Web platform when hovering over the icon in each row.

Segment - Alias

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

analytics.alias('newUserId');

For advanced use cases, this is used to update a User ID if it has changed.

Unsupported Segment Events

  • Group
  • Screen
  • Page