provider groups_types PUT /api/projects/{project_id}/groups_types/{group_type_index}/metrics/{id}/
@utdk/posthog /api/projects/{project_id}/groups_types/{group_type_index}/metrics/{id}/
groups_types_metrics_update
group_type_index path required
integer
id path required
A UUID string identifying this group usage metric.
string
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
groupsTypesMetricsUpdate
PUT/api/projects/{project_id}/groups_types/{group_type_index}/metrics/{id}/

Parameters

required
required

A UUID string identifying this group usage metric.

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 usage metric. Must be unique per group type within the project.

How the metric value is formatted in the UI. One of `numeric` or `currency`. * `numeric` - numeric * `currency` - currency

Rolling time window in days used to compute the metric. Defaults to 7.

Visual representation in the UI. One of `number` or `sparkline`. * `number` - number * `sparkline` - sparkline

required

Filter definition for the metric. Two shapes are accepted, discriminated by an optional `source` key. **Events** (default, when `source` is missing or `"events"`): HogFunction filter shape — `events: [...]`, optional `actions: [...]`, `properties: [...]`, `filter_test_accounts: bool`. **Data warehouse** (`source: "data_warehouse"`): `table_name` (synced DW table), `timestamp_field` (timestamp column or HogQL expression), `key_field` (column whose value matches the entity key). Currently DW metrics only render on group profiles — person profiles are not yet supported.

Aggregation function. `count` counts matching events; `sum` sums the value of `math_property` on matching events. * `count` - count * `sum` - sum

Required when `math` is `sum`; must be empty when `math` is `count`. For events metrics this is an event property name. For data warehouse metrics this is the column name (or HogQL expression) to sum on the DW table.

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.groupsTypesMetricsUpdate({
  "format": "numeric",
  "interval": 7,
  "display": "number",
  "math": "count"
})