Method: properties.getMetadata

Returns metadata for dimensions and metrics available in reporting methods. Used to explore the dimensions and metrics. In this method, a Google Analytics GA4 Property Identifier is specified in the request, and the metadata response includes Custom dimensions and metrics as well as Universal metadata.

For example if a custom metric with parameter name levels_unlocked is registered to a property, the Metadata response will contain customEvent:levels_unlocked. Universal metadata are dimensions and metrics applicable to any property such as country and totalUsers.

HTTP request

GET https://analyticsdata.googleapis.com/v1alpha/{name=properties/*/metadata}

The URL uses gRPC Transcoding syntax.

Path parameters

Parameters
name

string

Required. The resource name of the metadata to retrieve. This name field is specified in the URL path and not URL parameters. Property is a numeric Google Analytics GA4 Property identifier. To learn more, see where to find your Property ID.

Example: properties/1234/metadata

Set the Property ID to 0 for dimensions and metrics common to all properties. In this special mode, this method will not return custom dimensions and metrics.

Request body

The request body must be empty.

Response body

If successful, the response body contains data with the following structure:

The dimensions and metrics currently accepted in reporting methods.

JSON representation
{
  "name": string,
  "dimensions": [
    {
      object (DimensionMetadata)
    }
  ],
  "metrics": [
    {
      object (MetricMetadata)
    }
  ]
}
Fields
name

string

Resource name of this metadata.

dimensions[]

object (DimensionMetadata)

The dimension descriptions.

metrics[]

object (MetricMetadata)

The metric descriptions.

Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/analytics.readonly
  • https://www.googleapis.com/auth/analytics

DimensionMetadata

Explains a dimension.

JSON representation
{
  "apiName": string,
  "uiName": string,
  "description": string,
  "deprecatedApiNames": [
    string
  ],
  "customDefinition": boolean
}
Fields
apiName

string

This dimension's name. Useable in Dimension's name. For example, eventName.

uiName

string

This dimension's name within the Google Analytics user interface. For example, Event name.

description

string

Description of how this dimension is used and calculated.

deprecatedApiNames[]

string

Still usable but deprecated names for this dimension. If populated, this dimension is available by either apiName or one of deprecatedApiNames for a period of time. After the deprecation period, the dimension will be available only by apiName.

customDefinition

boolean

True if the dimension is a custom dimension for this property.

MetricMetadata

Explains a metric.

JSON representation
{
  "apiName": string,
  "uiName": string,
  "description": string,
  "deprecatedApiNames": [
    string
  ],
  "type": enum (MetricType),
  "expression": string,
  "customDefinition": boolean
}
Fields
apiName

string

A metric name. Useable in Metric's name. For example, eventCount.

uiName

string

This metric's name within the Google Analytics user interface. For example, Event count.

description

string

Description of how this metric is used and calculated.

deprecatedApiNames[]

string

Still usable but deprecated names for this metric. If populated, this metric is available by either apiName or one of deprecatedApiNames for a period of time. After the deprecation period, the metric will be available only by apiName.

type

enum (MetricType)

The type of this metric.

expression

string

The mathematical expression for this derived metric. Can be used in Metric's expression field for equivalent reports. Most metrics are not expressions, and for non-expressions, this field is empty.

customDefinition

boolean

True if the metric is a custom metric for this property.