Method: properties.calculatedMetrics.create
HTTP 要求
POST https://analyticsadmin.googleapis.com/v1alpha/{parent=properties/*}/calculatedMetrics
這個網址使用 gRPC 轉碼語法。
路徑參數
參數 |
parent |
string
必要欄位。格式:properties/{property_id} 範例:properties/1234
|
查詢參數
參數 |
calculatedMetricId |
string
必要欄位。計算指標的 ID,也就是計算指標資源名稱的最終元件。 這個值的長度應介於 1 至 80 個半形字元之間,有效字元為 /[a-zA-Z0-9_]/,且不得包含空格。計算指標 ID 在資源下的所有計算指標中不得重複。在從外部 API 參照這項計算指標時,會使用 calculatedMetricId,例如「calcMetric:{calculatedMetricId}」。
|
要求主體
要求主體包含 CalculatedMetric
的例項。
回應主體
如果成功,回應主體會包含新建立的 CalculatedMetric
例項。
授權範圍
需要下列 OAuth 範圍:
https://www.googleapis.com/auth/analytics.edit
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-01-14 (世界標準時間)。
[null,null,["上次更新時間:2025-01-14 (世界標準時間)。"],[[["Creates a new CalculatedMetric within a specified Google Analytics 4 property using an HTTP POST request."],["Requires providing a unique `calculatedMetricId` and the `property_id` as path and query parameters, respectively."],["The request body should contain the CalculatedMetric definition, and a successful response will return the newly created CalculatedMetric instance."],["Users need to have the `analytics.edit` OAuth scope to authorize this operation."]]],["This documentation details how to create a CalculatedMetric via a `POST` request to the specified URL, including required components such as path and query parameters, the request body and the response body. The path parameter `parent` defines the property ID. The query parameter `calculatedMetricId` is a unique identifier. The request and response bodies are `CalculatedMetric` instances. This action requires authorization scope: `https://www.googleapis.com/auth/analytics.edit`.\n"]]