Segment Streams
Export data to Segment
Overview
Sprig supports sending study responses to Segment (via Segment Streams) each time a response is received. These responses can then be exported to one or more of Segment's Destination integrations.
First, you will need to create the Sprig Source in Segment, and then you can configure one or more Segment destinations.
Connecting Sprig to Segment
- Sprig currently does not appear as a Source in Segment, but you can set an HTTP endpoint as a source in Segmentโs workspace to receive Sprigโs data as a stream. In Segment, click Connections, then click Sources.
- Search for HTTP in the Sources Catalog and click Add Source.
- Next, type in a Source name. As well as project-specific labels, consider incorporating the Sprig production and development environments in your naming convention.
- Type in the URL of your website and click Add Source.
- Click Copy Snippet and paste the code so that it is referenced in the section of all the pages that can display Studies.
- Click Settings and API Keys.
- Click Copy next to Write Key.
- In the Sprig app, click Integrations > Segment Stream.
- Click Add Key and paste the Write Key into the field.
- Click Save.
- Returning to the Source you just created in 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 Integrations 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 to Sprig's Integrations page viewed in Production.
A User ID is required to receive Sprig data in Segment. Sprig cannot respond 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.
Name | Description |
---|---|
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) |
event | Name of the action that a user has performed. We will use SDK - Submitted - Survey Response as a default value |
properties.surveyName | Name of the survey |
properties.surveyId | Uuid of the survey |
properties.createdAt | Timestamp when the survey was created (ISO-8061 format) |
properties.question | Question text |
properties.questionType | Question type |
properties.visitorId | Uuid of the visitor who submitted the response |
properties.oldVisitorId | [deprecated] Legacy identifier of a visitor. Different from visitorId (uuid), oldVisitorId is a number |
properties.responseGroupId | A response group is a set of responses for a visitor for a given survey |
properties.response | The survey response to the question |
properties.email | Visitor's email |
properties.attributes | Other attributes of the visitor, like plan, company, role etc. |
properties.triggeringEvent | The label of the event that triggered this survey. Can be NULL |
context | 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 |
sentAt | Timestamp of when a message is sent to Segment |
receivedAt | Automatically set by Segment, the timestamp of when a message is received by Segment |
timestamp | 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 | 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 |
Updated almost 2 years ago