Twilio Segment for metrics

Overview

This topic explains how to configure your existing Twilio Segment account to send events to LaunchDarkly metrics.

Sending Twilio Segment events to LaunchDarkly lets you use Twilio Segment events as LaunchDarkly metric events.

Twilio Segment can only send events to custom metrics

Twilio Segment can only send events to custom conversion binary, custom conversion count, and custom numeric metrics. You cannot use Segment events with clicked or tapped or page viewed metrics.

After you connect LaunchDarkly and Twilio Segment, you will use the existing Twilio Segment Event Name as the LaunchDarkly metric event key when you create a custom metric.

Here is an image of a LaunchDarkly custom conversion binary metric with the event key called out:

A LaunchDarkly custom conversion binary metric with the event key highlighted.

A LaunchDarkly custom conversion binary metric with the event key highlighted.

Events are specific to one LaunchDarkly environment. To learn more, read Event keys.

Set up the Twilio Segment integration

To set up the integration, you must have access to your Twilio Segment and LaunchDarkly accounts. You will need them both to connect them to each other.

Copy your LaunchDarkly client-side ID

Copy your LaunchDarkly client-side ID by following the instructions at View or copy keys and credentials.

You will use this client-side ID in the next section.

Connect Twilio Segment to LaunchDarkly

To connect Twilio Segment to LaunchDarkly:

  1. Navigate to the Twilio Segment app’s Destinations page.
  2. Click Add Destination.
  3. Find LaunchDarkly (Actions) in the Destination Catalog.

The LaunchDarkly (Actions) listing in the Twilio Segment Destination catalog.

The LaunchDarkly (Actions) listing in the Twilio Segment Destination catalog.
  1. Click Configure LaunchDarkly (Actions).
  2. Choose which Segment Source should send data to the LaunchDarkly destination.
  3. Click Next.
  4. Fill in the Destination name field with the name of your choice.
  5. Click Save.
  6. Paste the client-side ID from the previous procedure into the LaunchDarkly client-side ID field.
  7. Click Save Changes.
  8. Click the Enable Destination radio button.
  9. Click Save Changes.

The LaunchDarkly (Actions) Basic Settings form in Twilio Segment.

The LaunchDarkly (Actions) Basic Settings form in Twilio Segment.
  1. Navigate to the Mappings tab.
  2. Click New Mapping.
  3. Click Track Event.
  4. The Edit: Track Event page guides you through the process of mapping Segment Track events to LaunchDarkly metric events. The default settings should be acceptable for most customers.
Segment Event Names and LaunchDarkly event keys must match exactly

To use Twilio Segments events in LaunchDarkly metrics, the Twilio Segment Event Name must be identical to the LaunchDarkly metric event key. To learn how to set the event key when creating a LaunchDarkly metric, read Creating and managing metrics.

  1. Click Save.
  2. On the Mappings tab, click the radio buttons associated with the Track Event mapping to begin sending events to LaunchDarkly.

To learn more about track events, read Twilio Segment’s documentation.

After you map Twilio Segment events to LaunchDarkly metric events, events from the source you choose appear as custom metric events in LaunchDarkly.

Correlate Twilio Segment users with LaunchDarkly contexts

LaunchDarkly correlates Twilio Segment metric events with LaunchDarkly context keys using the Twilio Segment user ID, if it is present. The Twilio Segment user ID must match a LaunchDarkly context key. If the Twilio Segment event does not contain a Twilio Segment user ID, then LaunchDarkly uses the Twilio Segment anonymous ID.

If you are using Twilio Segment events in a LaunchDarkly experiment:

  • the LaunchDarkly metric must be attached to a flag and the experiment must be recording, and
  • the context must be included in the experiment for the event to be included in the experiment results.