Segment schema reference
Read time: 3 minutes
Last edited: Oct 30, 2024
Overview
This topic explains the different event kinds for Segment Data Export destinations. The JSON schemas for Segment are formatted differently than LaunchDarkly's. The index
, identify
, and summary
event kinds are not available in Segment Data Export destinations, and other events are exported with different labels.
To learn more about the Segment destination, read Segment's documentation.
There are four different event kinds exported to Segment. They are:
- Feature events: This event is emitted when a feature flag is evaluated.
- Click events: This event is emitted when an end user clicks on a CSS selector for which they have configured a metric in an experiment.
- Page view events: This event is emitted when an end user loads a page associated with an experiment metrics.
- Custom events: This event is emitted when LaunchDarkly SDK sends a
custom
event.
LaunchDarkly no longer supports alias
events for SDKs upgraded to contexts. LaunchDarkly continues to support sending and receiving alias events for older SDK versions. For a list of SDKs that still support alias
events, read Aliasing users.
Additional properties
Segment events include additional information about different LaunchDarkly properties. These properties are included in all event kinds.
These properties are:
Property name | Property details |
---|---|
event | The event kind. This field maps onto Segment's event field. |
environment | The LaunchDarkly environment ID, also called the client-side ID, corresponding to the event. |
project | The LaunchDarkly project ID corresponding to the event. |
key | The flag key corresponding to the event. In the case of Experimentation events, this will be the metric key for the experiment. |
userId | The key of the user object associated with the emitted event. For example, in client-side SDKs, this is the key of the currently identified user. This field maps onto Segment's userId field. |
Feature events
This table explains feature
event properties:
Property name | Description |
---|---|
value | The value of the evaluated flag. |
flagVersion | The version of the evaluated flag. |
inExperiment |
|
reasonKind | The evaluation reason for the flag. |
prereqOf | Set to another flag’s key if this flag evaluation was only performed in order to determine whether the prerequisite values were met for the indicated flag. |
default | Indicates whether the flag value was the result of the default variation being evaluated. |
variation | The variation of the flag requested. The SDK stores flag variation values in an array. This value corresponds to the index of the variation the array. Boolean flags show as |
variationName | The evaluated variation's name, if it exists. If the evaluated variation doesn't have a name, this field doesn't appear. |
Click events
This table explains click
event properties:
Property name | Description |
---|---|
url | The URL from which a user context triggered a flag evaluation. |
selector | The CSS selector corresponding to the |
Page view events
This table explains page view
event properties:
Property name | Description |
---|---|
url | The URL from which a user context triggered a flag evaluation. |
Custom events
Custom events contain the properties listed under Additional properties.
This table explains custom
event properties not listed in that section:
Property name | Description |
---|---|
metricValue | The numeric value of a metric if it is specified in the event. If no metric value was provided, this field doesn't appear. |