Creating metrics
Read time: 1 minute
Last edited: Aug 05, 2022
Overview
This topic explains how to create a metric to use within an experiment in LaunchDarkly.
Metrics are the measure against which you evaluate flag events. You can use metrics to track all kinds of things, from how often users access a URL to how long that URL takes to load a page. Create metrics that align with your business goals and connect them to your team's flags to track the impact of different flag variations over time.
You can also use the REST API: Metrics
Understanding types of metrics
Conversion metrics register events when a user takes an action based on a feature flag they encounter. Conversion metrics can track click
, page view
, and custom
event kinds. Numeric metrics measure numeric values against a baseline you set. Numeric metrics can track the conversion
event kind. To learn more about event kinds, read Analytics events.
There are four metric options in LaunchDarkly:
The following table explains the kinds of events you can track with a metric and their SDK compatibility:
Event kind | Metric | Description | SDK compatibility |
---|---|---|---|
Click | Conversion | Tracks the clicks on a user interface (UI) element. | JavaScript React |
Custom | Conversion | Tracks events for any arbitrary event. | All |
Custom | Numeric | Tracks increases or decreases in numeric value against a baseline you set. | All |
Page view | Conversion | Tracks how many times a page is viewed. | JavaScript React |
To learn more about Experimentation events, read Experimentation events.
Choosing a metric
You should choose a metric type that correctly measures the effect of a change on your users or codebase. If you are unsure of what metric type to use, it may be helpful to begin by determining what kind of data you are trying to measure.
This table includes examples of different kinds of data you can measure with different metric types:
Metric type | Example uses |
---|---|
Click conversion | How often do users click a "Save" button? How many times do users click on a link? When is the best point during a process to display a sign-up invitation? |
Custom conversion | Do user searches call a particular service? Do customers contact customer service within a set period of time? Do customers renew their contract within 30 days? Do user payments succeed? |
Custom numeric | How much do users spend per transaction in my store? How much do users spend in total? How many items do users purchase per transaction? How many items do users purchase total? How much time do users spend on a page? How long does it take for a server to respond to a request? How long until the time to first byte (TTFB)? |
Page view conversion | How many times do users view a blog post? |
Connecting a metric to an experiment
After you create a metric, you can use it in one or more experiments. To learn how, read Building experiments.
Deleting metrics
You should delete a metric only when you are sure you will no longer use it in any experiments.
To delete a metric:
- Navigate to the Experiments list.
- Click the Metrics tab.
- Click the title of the metric you want to delete. The "Edit metric" panel appears.
- Click Delete this metric.
This metric is now deleted permanently across all environments in the project.
You can also use the REST API: Delete metric