Google 애널리틱스용 MCP 서버를 사용해 보세요.
GitHub에서 설치하고
공지사항에서 자세한 내용을 확인하세요.
REST Resource: properties.calculatedMetrics
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
리소스: CalculatedMetric
JSON 표현 |
{
"name": string,
"description": string,
"displayName": string,
"calculatedMetricId": string,
"metricUnit": enum (MetricUnit ),
"restrictedMetricType": [
enum (RestrictedMetricType )
],
"formula": string,
"invalidMetricReference": boolean
} |
필드 |
name |
string
출력 전용입니다. 이 CalculatedMetric의 리소스 이름입니다. 형식: 'properties/{property_id}/CalculatedMetrics/{CalculatedMetricId}'
|
description |
string
선택사항입니다. 이 계산된 측정항목의 설명입니다. 최대 길이는 4,096자(영문 기준)입니다.
|
displayName |
string
필수 항목입니다. Google 애널리틱스 UI에 표시되는 계산된 이 측정항목의 표시 이름입니다. 최대 길이는 82자(영문 기준)입니다.
|
calculatedMetricId |
string
출력 전용입니다. 계산된 측정항목에 사용할 ID입니다. UI에서는 'API 이름'이라고 합니다. computeMetricId는 외부 API에서 이 계산된 측정항목을 참조할 때 사용됩니다. 예: 'calcMetric:{CalculatedMetricId}'
|
metricUnit |
enum (MetricUnit )
필수 항목입니다. 계산된 측정항목 값의 유형입니다.
|
restrictedMetricType[] |
enum (RestrictedMetricType )
출력 전용입니다. 이 측정항목에 포함된 제한된 데이터의 유형입니다.
|
formula |
string
필수 항목입니다. 계산된 측정항목의 정의입니다. 고유 참조된 맞춤 측정항목의 최대 개수는 5개입니다. 공식은 + (더하기), - (빼기), - (음수), * (곱하기), / (나누기), () (괄호)와 같은 연산을 지원합니다. Long (64비트 정수) 또는 Double (64비트 부동 소수점 수)에 들어가는 유효한 실수는 모두 허용됩니다. 수식 예: '( customEvent:parameterName +cartPurchaseQuantity ) / 2.0'
|
invalidMetricReference |
boolean
출력 전용입니다. true인 경우 이 계산된 측정항목에 잘못된 측정항목 참조가 있습니다. invalidMetricReference를 true로 설정하고 계산된 측정항목을 사용하는 작업은 실패하거나, 경고를 생성하거나, 예기치 않은 결과를 생성할 수 있습니다.
|
MetricUnit
계산된 측정항목의 값을 나타내는 가능한 유형입니다.
열거형 |
METRIC_UNIT_UNSPECIFIED |
MetricUnit이 지정되지 않았거나 누락되었습니다. |
STANDARD |
이 측정항목은 기본 단위를 사용합니다. |
CURRENCY |
이 측정항목은 통화를 측정합니다. |
FEET |
이 측정항목은 피트를 측정합니다. |
MILES |
이 측정항목은 마일을 측정합니다. |
METERS |
이 측정항목은 미터를 측정합니다. |
KILOMETERS |
이 측정항목은 킬로미터를 측정합니다. |
MILLISECONDS |
이 측정항목은 밀리초를 측정합니다. |
SECONDS |
이 측정항목은 초를 측정합니다. |
MINUTES |
이 측정항목은 분을 측정합니다. |
HOURS |
이 측정항목은 시간을 측정합니다. |
RestrictedMetricType
비용 또는 수익 측정항목에 대한 액세스를 제한하는 사용자 역할과 함께 사용되는 계산된 측정항목의 데이터를 표시하는 라벨입니다.
열거형 |
RESTRICTED_METRIC_TYPE_UNSPECIFIED |
알 수 없거나 지정되지 않은 유형입니다. |
COST_DATA |
측정항목에서는 비용 데이터를 보고합니다. |
REVENUE_DATA |
측정항목은 수익 데이터를 보고합니다. |
메서드 |
|
CalculatedMetric을 만듭니다. |
|
속성에서 CalculatedMetric을 삭제합니다. |
|
단일 CalculatedMetric을 조회합니다. |
|
속성의 CalculatedMetrics를 나열합니다. |
|
속성의 CalculatedMetric을 업데이트합니다. |
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-07-26(UTC)
[null,null,["최종 업데이트: 2025-07-26(UTC)"],[[["\u003cp\u003e\u003ccode\u003eCalculatedMetric\u003c/code\u003e allows you to create custom metrics using formulas based on existing metrics and parameters, with options for units like currency, time, or distance.\u003c/p\u003e\n"],["\u003cp\u003eYou can define the display name, description, and formula for your custom metric, along with specifying its unit of measurement.\u003c/p\u003e\n"],["\u003cp\u003eGoogle Analytics provides a dedicated resource and API for managing calculated metrics, allowing you to create, update, delete, and list them within your properties.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eCalculatedMetric\u003c/code\u003e resources have fields indicating if they contain cost or revenue data or have invalid metric references.\u003c/p\u003e\n"]]],["Calculated metrics are defined with a name, description, display name, and a unique ID. They also specify a `metricUnit` (e.g., standard, currency, feet) and can contain `restrictedMetricTypes` (cost or revenue data). The `formula` field defines the metric's calculation, supporting basic arithmetic. Methods include creating, deleting, retrieving, listing, and updating calculated metrics. Metrics can reference up to five custom metrics. `invalidMetricReference` flag indicates issues.\n"],null,["# REST Resource: properties.calculatedMetrics\n\n- [Resource: CalculatedMetric](#CalculatedMetric)\n - [JSON representation](#CalculatedMetric.SCHEMA_REPRESENTATION)\n- [MetricUnit](#MetricUnit)\n- [RestrictedMetricType](#RestrictedMetricType)\n- [Methods](#METHODS_SUMMARY)\n\nResource: CalculatedMetric\n--------------------------\n\nA definition for a calculated metric.\n\n| JSON representation |\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"name\": string, \"description\": string, \"displayName\": string, \"calculatedMetricId\": string, \"metricUnit\": enum (/analytics/devguides/config/admin/v1/rest/v1alpha/properties.calculatedMetrics#MetricUnit), \"restrictedMetricType\": [ enum (/analytics/devguides/config/admin/v1/rest/v1alpha/properties.calculatedMetrics#RestrictedMetricType) ], \"formula\": string, \"invalidMetricReference\": boolean } ``` |\n\n| Fields ||\n|--------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `name` | `string` Output only. Resource name for this CalculatedMetric. Format: 'properties/{property_id}/calculatedMetrics/{calculatedMetricId}' |\n| `description` | `string` Optional. Description for this calculated metric. Max length of 4096 characters. |\n| `displayName` | `string` Required. Display name for this calculated metric as shown in the Google Analytics UI. Max length 82 characters. |\n| `calculatedMetricId` | `string` Output only. The ID to use for the calculated metric. In the UI, this is referred to as the \"API name.\" The calculatedMetricId is used when referencing this calculated metric from external APIs. For example, \"calcMetric:{calculatedMetricId}\". |\n| `metricUnit` | `enum (`[MetricUnit](/analytics/devguides/config/admin/v1/rest/v1alpha/properties.calculatedMetrics#MetricUnit)`)` Required. The type for the calculated metric's value. |\n| `restrictedMetricType[]` | `enum (`[RestrictedMetricType](/analytics/devguides/config/admin/v1/rest/v1alpha/properties.calculatedMetrics#RestrictedMetricType)`)` Output only. Types of restricted data that this metric contains. |\n| `formula` | `string` Required. The calculated metric's definition. Maximum number of unique referenced custom metrics is 5. Formulas supports the following operations: + (addition), - (subtraction), - (negative), \\* (multiplication), / (division), () (parenthesis). Any valid real numbers are acceptable that fit in a Long (64bit integer) or a Double (64 bit floating point number). Example formula: \"( customEvent:parameterName + cartPurchaseQuantity ) / 2.0\" |\n| `invalidMetricReference` | `boolean` Output only. If true, this calculated metric has a invalid metric reference. Anything using a calculated metric with invalidMetricReference set to true may fail, produce warnings, or produce unexpected results. |\n\nMetricUnit\n----------\n\nPossible types of representing the calculated metric's value.\n\n| Enums ||\n|---------------------------|------------------------------------|\n| `METRIC_UNIT_UNSPECIFIED` | MetricUnit unspecified or missing. |\n| `STANDARD` | This metric uses default units. |\n| `CURRENCY` | This metric measures a currency. |\n| `FEET` | This metric measures feet. |\n| `MILES` | This metric measures miles. |\n| `METERS` | This metric measures meters. |\n| `KILOMETERS` | This metric measures kilometers. |\n| `MILLISECONDS` | This metric measures milliseconds. |\n| `SECONDS` | This metric measures seconds. |\n| `MINUTES` | This metric measures minutes. |\n| `HOURS` | This metric measures hours. |\n\nRestrictedMetricType\n--------------------\n\nLabels that mark the data in calculated metric used in conjunction with user roles that restrict access to cost and/or revenue metrics.\n\n| Enums ||\n|--------------------------------------|------------------------------|\n| `RESTRICTED_METRIC_TYPE_UNSPECIFIED` | Type unknown or unspecified. |\n| `COST_DATA` | Metric reports cost data. |\n| `REVENUE_DATA` | Metric reports revenue data. |\n\n| Methods ------- ||\n|-----------------------------------------------------------------------------------------------------|-------------------------------------------|\n| ### [create](/analytics/devguides/config/admin/v1/rest/v1alpha/properties.calculatedMetrics/create) | Creates a CalculatedMetric. |\n| ### [delete](/analytics/devguides/config/admin/v1/rest/v1alpha/properties.calculatedMetrics/delete) | Deletes a CalculatedMetric on a property. |\n| ### [get](/analytics/devguides/config/admin/v1/rest/v1alpha/properties.calculatedMetrics/get) | Lookup for a single CalculatedMetric. |\n| ### [list](/analytics/devguides/config/admin/v1/rest/v1alpha/properties.calculatedMetrics/list) | Lists CalculatedMetrics on a property. |\n| ### [patch](/analytics/devguides/config/admin/v1/rest/v1alpha/properties.calculatedMetrics/patch) | Updates a CalculatedMetric on a property. |"]]