This guide provides examples of metrics you can use with LaunchDarkly features such as Experimentation and guarded rollouts.
Metrics measure audience behaviors in your app or product and how those behaviors are affected by different flag variations. You can use metrics to track all kinds of things, from how often end users access a URL to how long that URL takes to load a page. How you set up a metric varies depending on what you want to measure. The examples included in this guide will help you understand how to configure metrics to meet your business needs.
You can use metric event filters in any custom metric to include only events that match specific context attributes or event properties. For example, you might filter a “Sign-up conversion” metric to include only users where the country context attribute is US or the plan context attribute is enterprise.
An event happens when someone 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 metric events to LaunchDarkly, where it can aggregate and analyze them using metrics. LaunchDarkly can then quantify the overall performance and health of your product and provide suggestions on how to respond.
For example, you can set up a purchase event in your app that sends the following information to LaunchDarkly:
Then you can configure a metric to calculate the average purchase total per user. With this metric, you can use Experimentation to compare two different versions of your shopping cart against each other to see which results in higher purchase totals, or use guarded rollouts to track purchase totals after you toggle on a site redesign to see if totals go up or down.
To learn more about events, read about click events, page view events, and custom events. To learn about how SDKs send events to LaunchDarkly, read Sending custom events.
There are five different types of metrics in LaunchDarkly:
You do not need to understand each of these options in-depth to use this guide, because each of the provided examples includes the suggested metric types. However, if you want a full explanation of each of these options, read Choose a metric type.
When you create a metric, you select an event to measure and then configure how the metric aggregates event values to contexts, and how collected data for the metric should be analyzed by an attached experiment or guarded rollout. The configuration options vary based on metric type you create.
Expand a section below to read about the configuration options for each metric type.
When you create a clicked or tapped conversion metric, you first provide one or more CSS selectors to define the interface elements that should generate events, as well as the target URLs that should generate events. Compatible LaunchDarkly client-side SDKs use this information to automatically generate events when users click the associated targets.
Next, you must decide:
Metrics that you plan to use in funnel metric groups must measure Occurrence.
Then, clicked or tapped conversion metric definition options include:
The default metric analysis method is “Average.” The use of percentile analysis methods with LaunchDarkly experiments is in beta. If you use a metric with a percentile analysis method in an experiment with a large audience, the experiment results tab may take longer to load, or the results tab may time out and display an error message. Percentile analysis methods are also not compatible with CUPED adjustments.
To create a custom conversion binary metric, you must first select Occurrence for what you want to measure. Metrics that measure Occurrence can be used in funnel metric groups.
Then, custom conversion binary metric definition options include:
When you create a custom conversion count metric, you must first select Count for what you want to measure. Metrics that measure by Count cannot be used in funnel metric groups.
Then, custom conversion count metric definition options include:
The default metric analysis method is Average. The use of percentile analysis methods with LaunchDarkly experiments is in beta. If you use a metric with a percentile analysis method in an experiment with a large audience, the experiment results tab may take longer to load, or the results tab may time out and display an error message. Percentile analysis methods are also not compatible with CUPED adjustments.
When you create a custom numeric metric, you must first select Value / Size as the measurement. Numeric metrics cannot be included in funnel metric groups.
Then, custom numeric metric definition options include:
Then, custom numeric metric definition options include:
The default metric analysis method is Average. The use of percentile analysis methods with LaunchDarkly experiments is in beta. If you use a metric with a percentile analysis method in an experiment with a large audience, the experiment results tab may take longer to load, or the results tab may time out and display an error message. Percentile analysis methods are also not compatible with CUPED adjustments.
When you create a page viewed conversion metric, you first define the target URLs that should generate events. Compatible LaunchDarkly client-side SDKs use this information to automatically generate events when users load the associated URL.
Next, you must decide:
Metrics that you plan to use in funnel metric groups must measure Occurrence.
Then, page viewed metric definition options include:
The default metric analysis method is Average. The use of percentile analysis methods with LaunchDarkly experiments is in beta. If you use a metric with a percentile analysis method in an experiment with a large audience, the experiment results tab may take longer to load, or the results tab may time out and display an error message. Percentile analysis methods are also not compatible with CUPED adjustments.
You do not need to understand each of these options in-depth to use this guide, because each of the provided examples includes the suggested unit analysis options. However, if you want a full explanation of each of these options, read Metric components.
This section includes the configuration options for common custom numeric metrics related to average purchase price per user. For all of the examples in this section, the randomization unit is “user.”
You can use this custom numeric metric to learn the average amount of money spent by users who made a purchase.
The metric configuration options include:
Here is what the metric setup looks like:

Here is an example of how the metric calculates its results:
This means that buyers spend an average of $9.
You can use this custom numeric metric to learn the average amount of money spent by all users, whether or not they made a purchase.
The metric configuration options include:
Here is what the metric setup looks like:

Here is an example of how the metric calculates its results:
This means that all users, including buyers and non-buyers, spend an average of $6.75.
This section includes the configuration options for a custom numeric metric related to percentile purchase price per user. For the example in this section, the randomization unit is “user.”
The default metric analysis method is “Average.” The use of percentile analysis methods with LaunchDarkly experiments is in beta. If you use a metric with a percentile analysis method in an experiment with a large audience, the experiment results tab may take longer to load, or the results tab may time out and display an error message. Percentile analysis methods are also not compatible with CUPED adjustments.
In this example, you are only interested in learning about your typical spenders and want to exclude the few customers who spend significantly more than most and skew your data upward. This metric calculates the amount of money that 90% of your customer base spends less than.
This custom numeric metric only includes users who made a purchase. When using a percentile analysis method, LaunchDarkly automatically excludes units without events.
The metric configuration options include:
Here is what the metric setup looks like:

Here is an example of how the metric calculates its results:
This means that 90% of all users that make a purchase spend less than $85.
This section includes the configuration options for common custom numeric metrics related to average revenue per user. For all of the examples in this section, the randomization unit is “user.”
This custom numeric metric sums purchase amounts per user who bought something, instead of calculating average amounts per purchase. This lets you find out about the purchasing behavior of users as a whole, ignoring whether the money they spent was all at once or spread between multiple purchases.
The metric configuration options include:
Here is what the metric setup looks like:

Here is an example of how the metric calculates its results:
This custom numeric metric sums purchase amounts per user, instead of calculating average amounts per purchase. This lets you find out about the purchasing behavior of users as a whole, ignoring whether the money they spent was all at once or spread between multiple purchases. This includes users who didn’t purchase anything.
The metric configuration options include:
Here is what the metric setup looks like:

Here is an example of how the metric calculates its results:
This section includes the configuration options for common custom conversion binary metrics related to average number of purchases. For the example in this section, the randomization unit is “user.”
You can use this custom conversion binary metric to learn the average number of purchases for users who made a purchase.
The metric configuration options include:
Here is what the metric setup looks like:

Here is an example of how the metric calculates its results:
This section includes the configuration options for common custom numeric metrics related to latency time. For the example in this section, the randomization unit is “request.”
The default metric analysis method is “Average.” The use of percentile analysis methods with LaunchDarkly experiments is in beta. If you use a metric with a percentile analysis method in an experiment with a large audience, the experiment results tab may take longer to load, or the results tab may time out and display an error message. Percentile analysis methods are also not compatible with CUPED adjustments.
This custom numeric metric calculates latency, excluding the slowest 1% of requests that may skew the data. When using a percentile analysis method, LaunchDarkly automatically excludes units without events.
The metric configuration options include:
Here is what the metric setup looks like:

Here is an example of how the metric calculates its results:
This means that 99% of requests, on average, have a latency of less than 70ms.
The guide explained how to set up metrics to help answer common questions about your app’s revenue and latency performance. For more examples of experiments you can run, read Example experiments.