• Home
  • Integrations
  • SDKs
  • Guides
  • API docs
No results for ""
EXPAND ALL

EDIT ON GITHUB

Segment schema reference

Read time: 1 minute
Last edited: Jun 29, 2021

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 types 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 five 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 a user clicks on a CSS selector for which they have configured a metric in an experiment.
  • Page view events: This event is emitted when a user loads a page associated with an experiment metrics.
  • Custom events: This event is emitted when LaunchDarkly SDK sends a custom event.
  • Alias events: This event is emitted when the LaunchDarkly SDK calls the Alias method or automatically in clientside SDKs when an anonymous user identifies as a non-anonyous user. Read more about Alias events on Segment's alias spec

Additional properties

Segment events include additional information about different LaunchDarkly properties. These properties are included in all event types.

These properties are:

Property nameProperty details
eventThe event type.
environmentThe LaunchDarkly environment ID corresponding to event.
projectThe LaunchDarkly project ID corresponding to the event.
keyThe flag key corresponding to the event. In the case of Experimentation events, this will be the metric key for the experiment.

Feature events

This table explains feature event properties:

Property nameDescription
valueThe value of the evaluated flag.
flagVersionThe version of the evaluated flag.
reasonKind

The evaluation reason for the flag.
To learn more, read Evaluation reasons.

  </TableCell>
</TableRow>
<TableRow>
  <TableCell><code>value</code></TableCell>
  <TableCell>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. <br/> To learn more, read <a href="/home/flags/prerequisites">Flag prerequisites</a>.
defaultIndicates whether the flag value was the result of the default variation being evaluated.
variationThe variation of the flag requested. Flag variation values are stored in an array. This value corresponds to the index of the variation the array. Boolean flags show as 0 or 1 for true and false, and other flag types are numbered starting with 0 for their different variations.
variationNameThe 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 nameDescription
urlThe URL from which a user triggered a flag evaluation.
selectorThe CSS selector corresponding to the click event.

Page view events

This table explains page view event properties:

Property nameDescription
urlThe URL from which a user triggered a flag evaluation.

Custom events

There are no properties for custom events other than the properties listed in Additional properties.

Alias events

The alias event schema is defined by Segment's spec. The following indicates LaunchDarkly's usage of the schema.

This table explains alias event properties:

Property nameDescription
PreviousIdThe previous key as defined by the SDK Alias method.
UserIdThe key as defined by the SDK Alias method.