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 アナリティクスの管理画面に表示されるこの計算指標の表示名。最大文字数は 82 文字です。
|
calculatedMetricId |
string
出力専用。計算指標に使用する ID。UI では、この名前を「API 名」と呼びます。 predictedMetricId は、外部 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 を更新します。 |
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は 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. |"]]