provider experiment_saved_metrics POST /api/projects/{project_id}/experiment_saved_metrics/
@utdk/posthog /api/projects/{project_id}/experiment_saved_metrics/
experiment_saved_metrics_create
project_id path required
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
string

Try it

Authentication
Configure credentials for PostHog API
experimentSavedMetricsCreate
POST/api/projects/{project_id}/experiment_saved_metrics/

Parameters

required

Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.

Input

required
required

Name of the shared metric. Must be unique within the project (case-insensitive).

Short description of what the metric measures.

required

ExperimentMetric JSON. Must have kind='ExperimentMetric' and a metric_type: 'mean' (set source to an EventsNode with an event name), 'funnel' (set series to an array of EventsNode steps), 'ratio' (set numerator and denominator EventsNode entries), or 'retention' (set start_event and completion_event). Legacy kinds (ExperimentTrendsQuery, ExperimentFunnelsQuery) are rejected for new shared metrics.

required
required
required
required

The effective access level the user has for this object

Configure credentials above to enable sending.

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

TypeScript

import posthog from '@utdk/posthog';

await posthog.experimentSavedMetricsCreate()