---
title: "POST /v1beta/properties/{propertiesId}/customMetrics"
method: POST
path: "/v1beta/properties/{propertiesId}/customMetrics"
tags: ["properties"]
---

# POST /v1beta/properties/{propertiesId}/customMetrics

`POST /v1beta/properties/{propertiesId}/customMetrics`

## Request

- Base URL: `https://analyticsadmin.googleapis.com`
- URL: `https://analyticsadmin.googleapis.com/v1beta/properties/{propertiesId}/customMetrics`
- Auth: OAuth 2 and OAuth 2
  - Implicit: `https://accounts.google.com/o/oauth2/auth`
  - Scopes: `https://www.googleapis.com/auth/analytics.edit`
  - Authorization code: `https://accounts.google.com/o/oauth2/auth`
  - Token URL: `https://accounts.google.com/o/oauth2/token` scopes: `https://www.googleapis.com/auth/analytics.edit`

Creates a CustomMetric.

## Path parameters

- `propertiesId` string, required

## Query parameters

- `$.xgafv` '1' | '2'
- `access_token` string
- `alt` 'json' | 'media' | 'proto'
- `callback` string
- `fields` string
- `key` string
- `oauth_token` string
- `prettyPrint` boolean
- `quotaUser` string
- `uploadType` string
- `upload_protocol` string

## Request body

- GoogleAnalyticsAdminV1betaCustomMetric: A definition for a custom metric.
  - `description` string: Optional. Description for this custom dimension. Max length of 150 characters.
  - `displayName` string: Required. Display name for this custom metric as shown in the Analytics UI. Max length of 82 characters, alphanumeric plus space and underscore starting with a letter. Legacy system-generated display names may contain square brackets, but updates to this field will never permit square brackets.
  - `measurementUnit` 'MEASUREMENT_UNIT_UNSPECIFIED' | 'STANDARD' | 'CURRENCY' | 'FEET' | 'METERS' | 'KILOMETERS' | 'MILES' | 'MILLISECONDS' | 'SECONDS' | 'MINUTES' | 'HOURS': Required. The type for the custom metric's value.
  - `name` string: Identifier. Resource name for this CustomMetric resource. Format: properties/{property}/customMetrics/{customMetric}
  - `parameterName` string: Required. Immutable. Tagging name for this custom metric. If this is an event-scoped metric, then this is the event parameter name. May only contain alphanumeric and underscore charactes, starting with a letter. Max length of 40 characters for event-scoped metrics.
  - `restrictedMetricType` string[]: Optional. Types of restricted data that this metric may contain. Required for metrics with CURRENCY measurement unit. Must be empty for metrics with a non-CURRENCY measurement unit.
  - `scope` 'METRIC_SCOPE_UNSPECIFIED' | 'EVENT': Required. Immutable. The scope of this custom metric.

## Response `200`

Successful response

- GoogleAnalyticsAdminV1betaCustomMetric: A definition for a custom metric.
  - `description` string: Optional. Description for this custom dimension. Max length of 150 characters.
  - `displayName` string: Required. Display name for this custom metric as shown in the Analytics UI. Max length of 82 characters, alphanumeric plus space and underscore starting with a letter. Legacy system-generated display names may contain square brackets, but updates to this field will never permit square brackets.
  - `measurementUnit` 'MEASUREMENT_UNIT_UNSPECIFIED' | 'STANDARD' | 'CURRENCY' | 'FEET' | 'METERS' | 'KILOMETERS' | 'MILES' | 'MILLISECONDS' | 'SECONDS' | 'MINUTES' | 'HOURS': Required. The type for the custom metric's value.
  - `name` string: Identifier. Resource name for this CustomMetric resource. Format: properties/{property}/customMetrics/{customMetric}
  - `parameterName` string: Required. Immutable. Tagging name for this custom metric. If this is an event-scoped metric, then this is the event parameter name. May only contain alphanumeric and underscore charactes, starting with a letter. Max length of 40 characters for event-scoped metrics.
  - `restrictedMetricType` string[]: Optional. Types of restricted data that this metric may contain. Required for metrics with CURRENCY measurement unit. Must be empty for metrics with a non-CURRENCY measurement unit.
  - `scope` 'METRIC_SCOPE_UNSPECIFIED' | 'EVENT': Required. Immutable. The scope of this custom metric.

---

[API](https://skmtc.dev/google/apis/analyticsadmin.md) - [All operations](https://skmtc.dev/google/apis/analyticsadmin/llms.txt) - [OpenAPI document](https://skmtc.dev/google/apis/analyticsadmin/revisions/2f06698abda1?raw)
