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

EDIT ON GITHUB

Metrics

Read time: 4 minutes
Last edited: Sep 15, 2023
Metrics is available for Pro and Enterprise plans

Metrics is available to customers on a Pro or Enterprise plan. To learn more, read about our pricing. To add Experimentation to your plan, contact Sales.

Overview

This topic explains how to create a metric to use within an experiment in LaunchDarkly.

Metrics measure audience behaviors affected by the flags in your experiments. You can use metrics to track all kinds of things, from how often customers 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.

To view your list of metrics, navigate to the Metrics list:

The metrics list.
The metrics list.

You can also use the REST API: Metrics

Understanding types of metrics

There are two main types of metrics in LaunchDarkly:

  • Conversion/binary metrics register events when an end user takes an action based on a feature flag they encounter.
  • Numeric metrics measure numeric values against a baseline you set. Numeric metrics can track the custom event kind. To learn more about event kinds, read Analytics events.

The following table explains the kinds of events you can track with a metric and their SDK compatibility:

Event kindMetricDescriptionSDK compatibility
ClickConversion

Tracks the clicks on a user interface (UI) element.

JavaScript
React
CustomConversion

Tracks events for any arbitrary event.

All
CustomNumeric

Tracks increases or decreases in numeric value against a baseline you set.

All
Page viewConversion

Tracks how many times a page is viewed.

JavaScript
React

You can send custom events using the track feature in your SDK. To learn more about Experimentation events, read Experimentation events.

Try it in your SDK: Sending custom events

Creating metrics

Click on the following links below to learn how to create each metric option:

Choosing metrics

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, it may be helpful to begin by determining what kind of data you are trying to measure.

When you create a metric, you will map the new metric to a context kind you have marked as available for experiments:

The "Randomization unit" mapping field in a metric creation panel.
The "Randomization unit" mapping field in a metric creation panel.

To learn more, read Randomization units.

This table includes examples of different kinds of data you can measure with different metric types, and common randomization unit context kind mappings:

Metric typeExample usesExample randomization unit context kind mappings
Click conversion

How often do customers click a "Save" button?
How many times do customers click on a link?
When is the best point during a process to display a sign-up invitation?

user
Custom conversion

Do customer 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 customer payments succeed?

user
organization
Custom numeric

How much do customers spend per transaction in my store?
How much do customers spend in total?
How many items do customers purchase per transaction?
How many items do customers purchase total?
How much time do customers 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)?

user
guest
request
Page view conversion

How many times do end users view a blog post?

user

Connecting metrics to an experiment

After you create a metric, you can use it in one or more experiments. The randomization unit you map the metric to must match the context kind you want to randomize on.

In this example, the experiment has a randomization unit of user. It is compatible with the chosen metric, because the metric can measure events from user context kinds.

The experiment creation screen with randomization units for the experiment and the metric called out.
The experiment creation screen with randomization units for the experiment and the metric called out.

To learn more, 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:

  1. Navigate to the Metrics list.
  2. Click the title of the metric you want to delete. The metric details screen opens.
  3. Click Delete.

This metric is now deleted permanently across all environments in the project.

You can also use the REST API: Delete metric