Reference documentation and code samples for the Google Analytics Admin V1alpha Client class CustomMetric.
A definition for a custom metric.
Generated from protobuf messagegoogle.analytics.admin.v1alpha.CustomMetric
Namespace
Google \ Analytics \ Admin \ V1alpha
Methods
__construct
Constructor.
Parameters
Name
Description
data
array
Optional. Data for populating the Message object.
↳ name
string
Output only. Resource name for this CustomMetric resource. Format: properties/{property}/customMetrics/{customMetric}
↳ parameter_name
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.
↳ display_name
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.
↳ description
string
Optional. Description for this custom dimension. Max length of 150 characters.
↳ measurement_unit
int
Required. The type for the custom metric's value.
↳ scope
int
Required. Immutable. The scope of this custom metric.
↳ restricted_metric_type
array
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.
getName
Output only. Resource name for this CustomMetric resource.
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.
Returns
Type
Description
string
setParameterName
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.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getDisplayName
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.
Returns
Type
Description
string
setDisplayName
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.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getDescription
Optional. Description for this custom dimension.
Max length of 150 characters.
Returns
Type
Description
string
setDescription
Optional. Description for this custom dimension.
Max length of 150 characters.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getMeasurementUnit
Required. The type for the custom metric's value.
Returns
Type
Description
int
setMeasurementUnit
Required. The type for the custom metric's value.
Parameter
Name
Description
var
int
Returns
Type
Description
$this
getScope
Required. Immutable. The scope of this custom metric.
Returns
Type
Description
int
setScope
Required. Immutable. The scope of this custom metric.
Parameter
Name
Description
var
int
Returns
Type
Description
$this
getRestrictedMetricType
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.
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.
[[["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 Admin V1alpha Client - Class CustomMetric (0.29.1)\n\nVersion latestkeyboard_arrow_down\n\n- [0.29.1 (latest)](/php/docs/reference/analytics-admin/latest/V1alpha.CustomMetric)\n- [0.29.0](/php/docs/reference/analytics-admin/0.29.0/V1alpha.CustomMetric)\n- [0.28.1](/php/docs/reference/analytics-admin/0.28.1/V1alpha.CustomMetric)\n- [0.27.0](/php/docs/reference/analytics-admin/0.27.0/V1alpha.CustomMetric)\n- [0.26.0](/php/docs/reference/analytics-admin/0.26.0/V1alpha.CustomMetric)\n- [0.25.2](/php/docs/reference/analytics-admin/0.25.2/V1alpha.CustomMetric)\n- [0.24.2](/php/docs/reference/analytics-admin/0.24.2/V1alpha.CustomMetric)\n- [0.23.0](/php/docs/reference/analytics-admin/0.23.0/V1alpha.CustomMetric)\n- [0.22.5](/php/docs/reference/analytics-admin/0.22.5/V1alpha.CustomMetric)\n- [0.20.0](/php/docs/reference/analytics-admin/0.20.0/V1alpha.CustomMetric)\n- [0.19.0](/php/docs/reference/analytics-admin/0.19.0/V1alpha.CustomMetric)\n- [0.18.1](/php/docs/reference/analytics-admin/0.18.1/V1alpha.CustomMetric)\n- [0.17.0](/php/docs/reference/analytics-admin/0.17.0/V1alpha.CustomMetric)\n- [0.16.0](/php/docs/reference/analytics-admin/0.16.0/V1alpha.CustomMetric)\n- [0.15.1](/php/docs/reference/analytics-admin/0.15.1/V1alpha.CustomMetric)\n- [0.14.0](/php/docs/reference/analytics-admin/0.14.0/V1alpha.CustomMetric)\n- [0.13.0](/php/docs/reference/analytics-admin/0.13.0/V1alpha.CustomMetric)\n- [0.12.0](/php/docs/reference/analytics-admin/0.12.0/V1alpha.CustomMetric)\n- [0.11.1](/php/docs/reference/analytics-admin/0.11.1/V1alpha.CustomMetric)\n- [0.10.0](/php/docs/reference/analytics-admin/0.10.0/V1alpha.CustomMetric)\n- [0.9.0](/php/docs/reference/analytics-admin/0.9.0/V1alpha.CustomMetric)\n- [0.8.2](/php/docs/reference/analytics-admin/0.8.2/V1alpha.CustomMetric) \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 Admin V1alpha Client class CustomMetric.\n\nA definition for a custom metric.\n\nGenerated from protobuf message `google.analytics.admin.v1alpha.CustomMetric`\n\nNamespace\n---------\n\nGoogle \\\\ Analytics \\\\ Admin \\\\ V1alpha\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getName\n\nOutput only. Resource name for this CustomMetric resource.\n\nFormat: properties/{property}/customMetrics/{customMetric}\n\n### setName\n\nOutput only. Resource name for this CustomMetric resource.\n\nFormat: properties/{property}/customMetrics/{customMetric}\n\n### getParameterName\n\nRequired. Immutable. Tagging name for this custom metric.\n\nIf this is an event-scoped metric, then this is the event parameter\nname.\nMay only contain alphanumeric and underscore charactes, starting with a\nletter. Max length of 40 characters for event-scoped metrics.\n\n### setParameterName\n\nRequired. Immutable. Tagging name for this custom metric.\n\nIf this is an event-scoped metric, then this is the event parameter\nname.\nMay only contain alphanumeric and underscore charactes, starting with a\nletter. Max length of 40 characters for event-scoped metrics.\n\n### getDisplayName\n\nRequired. Display name for this custom metric as shown in the Analytics UI.\n\nMax length of 82 characters, alphanumeric plus space and underscore\nstarting with a letter. Legacy system-generated display names may contain\nsquare brackets, but updates to this field will never permit square\nbrackets.\n\n### setDisplayName\n\nRequired. Display name for this custom metric as shown in the Analytics UI.\n\nMax length of 82 characters, alphanumeric plus space and underscore\nstarting with a letter. Legacy system-generated display names may contain\nsquare brackets, but updates to this field will never permit square\nbrackets.\n\n### getDescription\n\nOptional. Description for this custom dimension.\n\nMax length of 150 characters.\n\n### setDescription\n\nOptional. Description for this custom dimension.\n\nMax length of 150 characters.\n\n### getMeasurementUnit\n\nRequired. The type for the custom metric's value.\n\n### setMeasurementUnit\n\nRequired. The type for the custom metric's value.\n\n### getScope\n\nRequired. Immutable. The scope of this custom metric.\n\n### setScope\n\nRequired. Immutable. The scope of this custom metric.\n\n### getRestrictedMetricType\n\nOptional. Types of restricted data that this metric may contain. Required\nfor metrics with CURRENCY measurement unit. Must be empty for metrics with\na non-CURRENCY measurement unit.\n\n### setRestrictedMetricType\n\nOptional. Types of restricted data that this metric may contain. Required\nfor metrics with CURRENCY measurement unit. Must be empty for metrics with\na non-CURRENCY measurement unit."]]