Creating and managing metrics
Overview
This topic explains how to create, edit, archive, and delete metrics, and how to select metrics to use with LaunchDarkly features, such as experiments and guarded rollouts.
LaunchDarkly metrics can measure a wide variety of events such as user interface interactions or page views, or changes in your application codebase like the time required to process a transaction. The LaunchDarkly SDKs generate these metric events, and LaunchDarkly aggregates and analyzes the events based on the metrics you create.
Choose an event type
When you create a new metric, you begin by selecting one of the following metric event types:
-
Page viewed: These events are generated when a customer visits a specific page in your application. You instrument page viewed events directly in the LaunchDarkly user interface when you create a new Page viewed metric. Page viewed events and metrics require that you use a supported client SDKs.
-
Clicked or tapped: These events are generated by customer activities such as clicking an application button or selecting an option from a page. Similar to page viewed events, you instrument clicked or tapped events directly in the LaunchDarkly user interface when you create the new metric. You must use a supported client SDK to instrument Clicked or tapped metrics events in this way.
-
Custom: Custom events can record either customer activities or numeric system values, such as the time to complete a process or the cost of items in a customer’s shopping cart. You must instrument custom events directly your application code using the LaunchDarkly SDK
track()method, and your application must generate custom events before you create a metric for the event in the LaunchDarkly user interface.For example, you can instrument custom events to record page views or click or tap actions with a server-side SDK. You can also instrument custom events to record the total time it takes to complete a transaction, or the total value of a completed transaction.
Choose a metric type
You can use any of the metric event types to create conversion metrics, which aggregate and analyze events when an end user takes an action based on a feature flag they encounter. You must use custom events to create numeric metrics, which measure and analyze numerical values against a baseline that you set.
This table includes examples of different kinds of events you can measure using different metric types, and the common randomization unit context kind mappings:
You should choose a metric type that correctly measures the effect of a change on your customers or codebase. If you are unsure of what metric type to use, begin by determining what kind event you are trying to measure. For additional examples of common metrics and how to configure them, read Example metrics.
When you create a metric, you must also decide how you want to handle its metric and unit analysis. To learn more, read Metric analysis.
Create metrics
Click the following links to learn how to create each metric type:
- Page viewed conversion metrics
- Clicked or tapped conversion metrics
- Custom conversion count metrics
- Custom conversion binary metrics
- Custom numeric metrics
Edit metrics
You can edit all of an existing metric’s settings except for its metric kind and metric key.
To edit a metric:
- Navigate to the Metrics list.
- Click the name of the metric you want to edit. The metric details screen opens.
- Click the pencil icon in the right sidebar next to the field you want to edit. The “Edit metric” dialog appears.
- Make the edits you want and click Save metric.
You can also use the REST API: Update metric
Archive metrics
Archiving a metric removes it from the metrics list, dashboards, and metric selectors, while preserving its definition and historical results. Archiving helps reduce clutter and maintain a clean workspace during guarded rollouts and experiments.
Archiving a metric creates a new version. This version reflects the archived state and preserves earlier versions for accurate experiment analysis and audit history. You can view a metric’s current and previous versions on its details page, each reflecting how the metric was configured when it was used.
You can archive a metric unless it is currently used in an active experiment, guarded rollout, or metric group. If the metric is in use, LaunchDarkly disables the archive option and displays a list of the connections.
To archive a metric:
- Navigate to the Metrics list.
- Next to the name of the metric you want to archive, click the three-dot overflow menu.
- Click Archive metric. A confirmation dialog appears that lists the number of experiments, guarded rollouts, and metric groups the metric is connected to.
- Click Archive.
By default, LaunchDarkly hides archived metrics from the metrics list, experiment setup screens, and metric selection menus. To view them, turn on the Show archived filter in the metrics list.
You can restore an archived metric at any time. When you restore a metric, it returns to active use and reappears in the metrics list, metric selectors, and dashboards.
To restore an archived metric:
- Navigate to the Metrics list.
- Turn on the Show archived filter.
- Next to the name of the metric you want to restore, click the three-dot overflow menu.
- Click Restore. A confirmation dialog appears.
- Click Restore.
You can also use the REST API: Update metric. To archive or restore a metric, replace the archived field with true or false.
LaunchDarkly automatically sets the archivedAt timestamp when you archive a metric and clears it when you restore it. You cannot set or modify this field manually.
To archive or restore a metric, your role must include the updateArchived action for the metric resource.
View metric details
After you create a metric, you can view its configuration, connections, and recent activity from the metric details page.
To open a metric:
- Navigate to the Metrics list.
- Click the name of the metric you want to view.
The metric details page includes three tabs and a right-hand sidebar that summarize all available information about the metric.
Details tab
The Details tab displays configuration fields such as event key, metric type, definition, and success criteria. It also shows the Connections section, which lists any experiments, guarded rollouts, or metric groups using the metric.
To learn more about metric definition options, read Metric analysis.
Impact tab
The Impact tab lists the experiments that include the metric and shows current effect sizes, variation performance, and experiment status.
Activity tab
The Activity tab shows the most recent events associated with the metric, including timestamp, context key, and value. This helps you verify that your SDK instrumentation is working correctly. To learn more, read Metric events.
Sidebar information
The sidebar displays additional metadata about the metric, including:
- Description
- Maintainer
- Tags
- Sources
- Metric key
Event keys and metric keys are different
Sending custom events to LaunchDarkly requires a unique event key. You can set the event key to anything you want. The metric key is generated automatically and is used only to identify the metric in API calls. To learn more, read Metric events.

To analyze a metric’s results, read Metric analysis. To view or filter events associated with a metric, read Metric events.
Filter metrics
After you create a metric, you can optionally configure metric event filters to control which events are included in its analysis. This lets you focus the metric on specific context attributes or event properties, such as events where the variationKey is treatment or the country context attribute is CA.
To learn more, read Filtering custom metric events.
Delete metrics
Deleting a metric is irreversible. You cannot recover a metric after you delete it.
LaunchDarkly recommends archiving metrics instead of deleting them. Archiving preserves the metric’s historical data and audit trail, and removes it from selection menus and dashboards by default.
You can only delete a metric if:
- It is already archived
- It has never been used in any experiments or guarded releases
To delete a metric:
- Navigate to the Metrics list.
- Turn on the Show archived filter.
- Click the name of the archived metric you want to delete. The metric details screen opens.
- If the metric has never been used in an experiment or guarded release, click Delete metric. A confirmation dialog appears.
- Click Delete metric.
You can also use the REST API: Delete metric