provider Metrics POST /api/v2/metrics/{projectKey}
@utdk/launchdarkly /api/v2/metrics/{projectKey}
Create metric
Create a new metric in the specified project. The expected `POST` body differs depending on the specified `kind` property.
projectKey path required
The project key
string

Try it

Authentication
Configure credentials for LaunchDarkly REST API
Gateway
The gateway proxies requests and injects credentials server-side. Configure credentials above, then enter your gateway URL.

Saved automatically to browser storage.

postmetric
POST/api/v2/metrics/{projectKey}
Create a new metric in the specified project. The expected `POST` body differs depending on the specified `kind` property.

Parameters

required

The project key

Input

required

A unique key to reference the metric

A human-friendly name for the metric

Description of the metric

required

The kind of event your metric will track

One or more CSS selectors. Required for click metrics only.

One or more target URLs. Required for click and pageview metrics only.

Whether to track numeric changes in value against a baseline (<code>true</code>) or to track a conversion when an end user takes an action (<code>false</code>). Required for custom and trace metrics only.

The unit of measure. Applicable for numeric custom and trace metrics only.

The event key to use in your code. Required for custom conversion/binary and custom numeric metrics only.

Success criteria. Required for custom and trace numeric metrics, optional for custom and trace conversion metrics.

Tags for the metric

Deprecated, use <code>analysisUnits</code> instead.

An array of analysis units allowed for this metric.

The ID of the member who maintains this metric

The method by which multiple unit event values are aggregated

The method for analyzing metric events

The percentile for the analysis method. An integer denoting the target percentile between 0 and 100. Required when <code>analysisType</code> is <code>percentile</code>.

Not yet implemented - The start of the measurement window, in milliseconds relative to the unit's first exposure to a flag variation

Not yet implemented - The end of the measurement window, in milliseconds relative to the unit's first exposure to a flag variation

Lower winsorization percentile, expressed as a percent in the open interval (0, 100). When both bounds are set, defines a two-sided clamp range. Otherwise lower-only winsorization.

Upper winsorization percentile, expressed as a percent in the open interval (0, 100). When both bounds are set, must be greater than winsorLowerPercentile.

When true, the percentile bound calculation excludes imputed zeros. Only meaningful when at least one bound is set and the metric includes units that didn't send events.

The trace query to use for the metric. Required for trace metrics.

The location in the trace to use for numeric values. Required for numeric trace metrics.

Enter a gateway URL above to enable sending.

Code snippet
Updates live as you fill in the form above.

TypeScript

import launchdarkly from '@utdk/launchdarkly';

await launchdarkly.postmetric()