|
| 1 | +--- |
| 2 | +title: LaunchDarkly-subscription Destination |
| 3 | +rewrite: true |
| 4 | +--- |
| 5 | +LaunchDarkly is a feature management platform that empowers development teams to safely deliver and control software through feature flags. |
| 6 | + |
| 7 | +LaunchDarkly users can run experiments on any feature flag, with custom events as metrics. You can look for an existing custom event from Segment, and start recording data against it as a metric in your LaunchDarkly experiment. |
| 8 | + |
| 9 | +This destination is maintained by LaunchDarkly. For any issues with the destination, [contact the LaunchDarkly support team ](mailto:[email protected]). |
| 10 | + |
| 11 | +## Getting Started |
| 12 | + |
| 13 | +{% include content/connection-modes.md %} |
| 14 | + |
| 15 | +1. From the Destinations catalog page in the Segment App, click **Add Destination**. |
| 16 | +2. Search for “LaunchDarkly” in the Destinations Catalog, and select the LaunchDarkly destination. |
| 17 | +3. Choose which Source should send data to the LaunchDarkly destination. |
| 18 | +4. Go to the LaunchDarkly [Account Settings](https://app.launchdarkly.com/settings/projects), and find and copy the client-side ID from your default project. |
| 19 | +5. Enter this ID as the **API Key** in the “LaunchDarkly” destination settings in Segment. |
| 20 | + |
| 21 | +## Track |
| 22 | +If you aren't familiar with the Segment Spec, take a look at the [Track method documentation](https://segment.com/docs/connections/spec/track/) to learn about what it does. An example call would look like: |
| 23 | + |
| 24 | +```javascript |
| 25 | +analytics.track('Order Completed', |
| 26 | + { |
| 27 | + value: 99.84, |
| 28 | + type: "expedited" |
| 29 | + } |
| 30 | +) |
| 31 | +``` |
| 32 | + |
| 33 | +LaunchDarkly ingests that call as: |
| 34 | + |
| 35 | +```json |
| 36 | +{ |
| 37 | + "kind": "custom", |
| 38 | + "key": "Order Completed", |
| 39 | + "userKey": "userId", |
| 40 | + "creationDate": 1592588370692, |
| 41 | + "metricValue": 99.84, |
| 42 | + "data": { |
| 43 | + "value": 99.84, |
| 44 | + "type": "expedited" |
| 45 | + } |
| 46 | +} |
| 47 | +``` |
| 48 | + |
| 49 | +Segment sends Track calls to LaunchDarkly as a `track` event. It appears on your [Debugger page](https://app.launchdarkly.com/default/production/debugger/goals). |
| 50 | + |
| 51 | +`track` events map to a Metric if the Segment event name exactly matches the Name of an active LaunchDarkly experiment metric. |
| 52 | + |
| 53 | +The `userKey` field maps to the `userId` field; if there is no `userId` field, LaunchDarkly uses `anonymousId` field for the `userKey` field. |
| 54 | + |
| 55 | +> note "" |
| 56 | +> **Note**: The LaunchDarkly Metric must be actively recording and have a Feature Flag attached. |
0 commit comments