No results for ""
EXPAND ALL
  • Home
  • API docs

GIVE DOCS FEEDBACK

Metrics

Read time: 5 minutes
Last edited: Mar 26, 2024
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 and use metrics within LaunchDarkly.

Metrics measure audience behaviors affected by flags. 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.

To learn how to create, edit, and delete metrics, read Creating metrics.

You can also use the REST API: Metrics

The metric details page

From the metrics list, click on a metric name to view the details page for that metric.

The metric details page displays:

  • The metric's event information, including:
    • Event kind: custom conversion or binary, click, or page view
    • Event key: the value you insert into your code to track events
    • For numeric metrics only: success criteria, either higher or lower than the baseline
  • The metric's measurement configuration, including:
  • Randomization units: context kind, such as user, device, or request, that the metric calculates and analyzes by
  • Tags
  • Connections to any experiments or guarded releases, including information on the experiment name, status, environment, and metric status
Metric keys and event keys are different

LaunchDarkly automatically generates a metric key when you create a metric. You can use the metric key to identify the metric in API calls. To learn more, read Creating metrics.

Custom conversion/binary and custom numeric metrics also require an event key. You can set the event key to anything you want. Adding this event key to your codebase lets your SDK track actions customers take in your app as events. To learn more, read Sending custom events.

You can also use the REST API: Get metric

Metric events

An "event" happens when an end user takes an action in your app, such as clicking on a button, or when a system takes an action, such as loading a page. Your SDKs send these events to LaunchDarkly, where LaunchDarkly metrics can aggregate and analyze them. LaunchDarkly can then quantify the overall performance and health of your product and provide suggestions on how to respond.

There are three types of metric events:

  • custom events are produced by custom conversion/binary metrics and custom numeric metrics
    • 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
  • click events are produced by custom click metrics
  • page view events are produced by custom page view metrics

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

Try it in your SDK: Sending custom events

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

Event kindMetricDescriptionSDK compatibility
CustomConversion/binary

Tracks events for any arbitrary event.

All
CustomNumeric

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

All
ClickConversion

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

Electron
JavaScript
Node.js (client-side)
React Web
Vue
Page viewConversion

Tracks how many times a page is viewed.

Electron
JavaScript
Node.js (client-side)
React Web
Vue

To learn more about different metric types and when to use them, read Choosing a metric type.

For examples of common metrics and how to configure them, read Example metrics.

Event keys

When you create a custom conversion/binary or custom numeric metric, you must set an event key for the metric. You will use this event key in your codebase to track actions taken by your users or other contexts. You can set the event key to anything you want, and it may already exist in your codebase.

The event key in your metric and the event key in your code must match exactly. This lets your SDK track actions customers take in your app as events.

To learn more, read Sending custom events.

Metric versions

When you create a new metric, the metric has a version of 1. Each time you edit and save the metric, LaunchDarkly increments the metric version. This ensures that experiments, measured releases, and other features continue to display the correct analysis for the metric as it was configured at the time of its use. If you make edits to a metric currently in use, any LaunchDarkly feature using it will continue to use the old version of the metric.

For example, if you create an experiment using version 1 of a metric, then edit the metric while the experiment is running, the experiment will continue to use version 1 of the metric until you stop the experiment iteration. This ensures the experiment analysis is valid. Any new iterations of the experiment you begin later will then use version 2 of the metric.

Metric groups

A metric group is a reusable, ordered list of metrics you can use to standardize metrics across multiple experiments and flags.

From the Metrics list, click on the Metric groups tab to view a list of your metric groups. To learn more, read Metric groups.