Reference documentation and code samples for the Google Analytics Data V1beta Client class MetricMetadata.
Explains a metric.
Generated from protobuf messagegoogle.analytics.data.v1beta.MetricMetadata
Namespace
Google \ Analytics \ Data \ V1beta
Methods
__construct
Constructor.
Parameters
Name
Description
data
array
Optional. Data for populating the Message object.
↳ api_name
string
A metric name. Useable inMetric'sname. For example,eventCount.
↳ ui_name
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.
↳ deprecated_api_names
array
Still usable but deprecated names for this metric. If populated, this metric is available by eitherapiNameor one ofdeprecatedApiNamesfor a period of time. After the deprecation period, the metric will be available only byapiName.
↳ type
int
The type of this metric.
↳ expression
string
The mathematical expression for this derived metric. Can be used inMetric'sexpressionfield for equivalent reports. Most metrics are not expressions, and for non-expressions, this field is empty.
↳ custom_definition
bool
True if the metric is a custom metric for this property.
↳ blocked_reasons
array
If reasons are specified, your access is blocked to this metric for this property. API requests from you to this property for this metric will succeed; however, the report will contain only zeros for this metric. API requests with metric filters on blocked metrics will fail. If reasons are empty, you have access to this metric. To learn more, seeAccess and data-restriction management.
↳ category
string
The display name of the category that this metrics belongs to. Similar dimensions and metrics are categorized together.
getApiName
A metric name. Useable inMetric'sname. For example,eventCount.
Returns
Type
Description
string
setApiName
A metric name. Useable inMetric'sname. For example,eventCount.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getUiName
This metric's name within the Google Analytics user interface. For example,Event count.
Returns
Type
Description
string
setUiName
This metric's name within the Google Analytics user interface. For example,Event count.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getDescription
Description of how this metric is used and calculated.
Returns
Type
Description
string
setDescription
Description of how this metric is used and calculated.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getDeprecatedApiNames
Still usable but deprecated names for this metric. If populated, this
metric is available by eitherapiNameor one ofdeprecatedApiNamesfor a period of time. After the deprecation period, the metric will be
available only byapiName.
Still usable but deprecated names for this metric. If populated, this
metric is available by eitherapiNameor one ofdeprecatedApiNamesfor a period of time. After the deprecation period, the metric will be
available only byapiName.
Parameter
Name
Description
var
string[]
Returns
Type
Description
$this
getType
The type of this metric.
Returns
Type
Description
int
setType
The type of this metric.
Parameter
Name
Description
var
int
Returns
Type
Description
$this
getExpression
The mathematical expression for this derived metric. Can be used inMetric'sexpressionfield for equivalent reports. Most metrics
are not expressions, and for non-expressions, this field is empty.
Returns
Type
Description
string
setExpression
The mathematical expression for this derived metric. Can be used inMetric'sexpressionfield for equivalent reports. Most metrics
are not expressions, and for non-expressions, this field is empty.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getCustomDefinition
True if the metric is a custom metric for this property.
Returns
Type
Description
bool
setCustomDefinition
True if the metric is a custom metric for this property.
Parameter
Name
Description
var
bool
Returns
Type
Description
$this
getBlockedReasons
If reasons are specified, your access is blocked to this metric for this
property. API requests from you to this property for this metric will
succeed; however, the report will contain only zeros for this metric. API
requests with metric filters on blocked metrics will fail. If reasons are
empty, you have access to this metric.
If reasons are specified, your access is blocked to this metric for this
property. API requests from you to this property for this metric will
succeed; however, the report will contain only zeros for this metric. API
requests with metric filters on blocked metrics will fail. If reasons are
empty, you have access to this metric.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Google Analytics Data V1beta Client - Class MetricMetadata (0.22.3)\n\nVersion latestkeyboard_arrow_down\n\n- [0.22.3 (latest)](/php/docs/reference/analytics-data/latest/V1beta.MetricMetadata)\n- [0.22.2](/php/docs/reference/analytics-data/0.22.2/V1beta.MetricMetadata)\n- [0.21.1](/php/docs/reference/analytics-data/0.21.1/V1beta.MetricMetadata)\n- [0.20.1](/php/docs/reference/analytics-data/0.20.1/V1beta.MetricMetadata)\n- [0.19.0](/php/docs/reference/analytics-data/0.19.0/V1beta.MetricMetadata)\n- [0.18.0](/php/docs/reference/analytics-data/0.18.0/V1beta.MetricMetadata)\n- [0.17.1](/php/docs/reference/analytics-data/0.17.1/V1beta.MetricMetadata)\n- [0.16.4](/php/docs/reference/analytics-data/0.16.4/V1beta.MetricMetadata)\n- [0.14.0](/php/docs/reference/analytics-data/0.14.0/V1beta.MetricMetadata)\n- [0.13.0](/php/docs/reference/analytics-data/0.13.0/V1beta.MetricMetadata)\n- [0.12.0](/php/docs/reference/analytics-data/0.12.0/V1beta.MetricMetadata)\n- [0.11.2](/php/docs/reference/analytics-data/0.11.2/V1beta.MetricMetadata)\n- [0.10.1](/php/docs/reference/analytics-data/0.10.1/V1beta.MetricMetadata)\n- [0.9.5](/php/docs/reference/analytics-data/0.9.5/V1beta.MetricMetadata) \n| **Beta**\n|\n|\n| This library is covered by the [Pre-GA Offerings Terms](/terms/service-terms#1)\n| of the Terms of Service. Pre-GA libraries might have limited support,\n| and changes to pre-GA libraries might not be compatible with other pre-GA versions.\n| For more information, see the\n[launch stage descriptions](/products#product-launch-stages). \nReference documentation and code samples for the Google Analytics Data V1beta Client class MetricMetadata.\n\nExplains a metric.\n\nGenerated from protobuf message `google.analytics.data.v1beta.MetricMetadata`\n\nNamespace\n---------\n\nGoogle \\\\ Analytics \\\\ Data \\\\ V1beta\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getApiName\n\nA metric name. Useable in [Metric](#Metric)'s `name`. For example,\n`eventCount`.\n\n### setApiName\n\nA metric name. Useable in [Metric](#Metric)'s `name`. For example,\n`eventCount`.\n\n### getUiName\n\nThis metric's name within the Google Analytics user interface. For example,\n`Event count`.\n\n### setUiName\n\nThis metric's name within the Google Analytics user interface. For example,\n`Event count`.\n\n### getDescription\n\nDescription of how this metric is used and calculated.\n\n### setDescription\n\nDescription of how this metric is used and calculated.\n\n### getDeprecatedApiNames\n\nStill usable but deprecated names for this metric. If populated, this\nmetric is available by either `apiName` or one of `deprecatedApiNames`\nfor a period of time. After the deprecation period, the metric will be\navailable only by `apiName`.\n\n### setDeprecatedApiNames\n\nStill usable but deprecated names for this metric. If populated, this\nmetric is available by either `apiName` or one of `deprecatedApiNames`\nfor a period of time. After the deprecation period, the metric will be\navailable only by `apiName`.\n\n### getType\n\nThe type of this metric.\n\n### setType\n\nThe type of this metric.\n\n### getExpression\n\nThe mathematical expression for this derived metric. Can be used in\n[Metric](#Metric)'s `expression` field for equivalent reports. Most metrics\nare not expressions, and for non-expressions, this field is empty.\n\n### setExpression\n\nThe mathematical expression for this derived metric. Can be used in\n[Metric](#Metric)'s `expression` field for equivalent reports. Most metrics\nare not expressions, and for non-expressions, this field is empty.\n\n### getCustomDefinition\n\nTrue if the metric is a custom metric for this property.\n\n### setCustomDefinition\n\nTrue if the metric is a custom metric for this property.\n\n### getBlockedReasons\n\nIf reasons are specified, your access is blocked to this metric for this\nproperty. API requests from you to this property for this metric will\nsucceed; however, the report will contain only zeros for this metric. API\nrequests with metric filters on blocked metrics will fail. If reasons are\nempty, you have access to this metric.\n\nTo learn more, see [Access and data-restriction\nmanagement](https://support.google.com/analytics/answer/10851388).\n\n### setBlockedReasons\n\nIf reasons are specified, your access is blocked to this metric for this\nproperty. API requests from you to this property for this metric will\nsucceed; however, the report will contain only zeros for this metric. API\nrequests with metric filters on blocked metrics will fail. If reasons are\nempty, you have access to this metric.\n\nTo learn more, see [Access and data-restriction\nmanagement](https://support.google.com/analytics/answer/10851388).\n\n### getCategory\n\nThe display name of the category that this metrics belongs to. Similar\ndimensions and metrics are categorized together.\n\n### setCategory\n\nThe display name of the category that this metrics belongs to. Similar\ndimensions and metrics are categorized together."]]