Google Analytics · JSON Structure

Admin Api Custom Metric Structure

A definition for a custom metric.

Type: object Properties: 7
AnalyticsDataGoogleMetricsReportingWeb AnalyticsMachine LearningAttribution

CustomMetric is a JSON Structure definition published by Google Analytics, describing 7 properties. It conforms to the https://json-structure.org/meta/core/v0/# meta-schema.

Properties

description displayName measurementUnit name parameterName restrictedMetricType scope

Meta-schema: https://json-structure.org/meta/core/v0/#

JSON Structure

Raw ↑
{
  "$schema": "https://json-structure.org/meta/core/v0/#",
  "$id": "https://raw.githubusercontent.com/api-evangelist/google-analytics/refs/heads/main/json-structure/admin-api-custom-metric-structure.json",
  "name": "CustomMetric",
  "description": "A definition for a custom metric.",
  "type": "object",
  "properties": {
    "description": {
      "description": "Optional. Description for this custom dimension. Max length of 150 characters.",
      "type": "string"
    },
    "displayName": {
      "description": "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.",
      "type": "string"
    },
    "measurementUnit": {
      "description": "Required. The type for the custom metric's value.",
      "enum": [
        "MEASUREMENT_UNIT_UNSPECIFIED",
        "STANDARD",
        "CURRENCY",
        "FEET",
        "METERS",
        "KILOMETERS",
        "MILES",
        "MILLISECONDS",
        "SECONDS",
        "MINUTES",
        "HOURS"
      ],
      "type": "string"
    },
    "name": {
      "description": "Output only. Resource name for this CustomMetric resource. Format: properties/{property}/customMetrics/{customMetric}",
      "readOnly": true,
      "type": "string"
    },
    "parameterName": {
      "description": "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.",
      "type": "string"
    },
    "restrictedMetricType": {
      "description": "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.",
      "items": {
        "enum": [
          "RESTRICTED_METRIC_TYPE_UNSPECIFIED",
          "COST_DATA",
          "REVENUE_DATA"
        ],
        "type": "string"
      },
      "type": "array"
    },
    "scope": {
      "description": "Required. Immutable. The scope of this custom metric.",
      "enum": [
        "METRIC_SCOPE_UNSPECIFIED",
        "EVENT"
      ],
      "type": "string"
    }
  }
}