כדאי לנסות את שרת ה-MCP ל-Google Analytics. אפשר להתקין מ-
GitHub, ולקרוא את
ההודעה לפרטים נוספים.
REST Resource: properties.calculatedMetrics
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
משאב: ACCOUNTdMetric
ייצוג JSON |
{
"name": string,
"description": string,
"displayName": string,
"calculatedMetricId": string,
"metricUnit": enum (MetricUnit ),
"restrictedMetricType": [
enum (RestrictedMetricType )
],
"formula": string,
"invalidMetricReference": boolean
} |
שדות |
name |
string
פלט בלבד. שם המשאב של ה-ComputedMetric הזה. פורמט: 'properties/{property_id}/calculatedMetrics/{calculatedMetricId}'
|
description |
string
זה שינוי אופציונלי. תיאור של המדד המחושב הזה. אורך מקסימלי של 4,096 תווים.
|
displayName |
string
חובה. השם המוצג של המדד המחושב, כפי שמוצג בממשק המשתמש של Google Analytics. האורך המרבי הוא 82 תווים.
|
calculatedMetricId |
string
פלט בלבד. המזהה שצריך להשתמש בו במדד המחושב. בממשק המשתמש, נקרא 'שם ה-API'. המחושב המחושב משמש כהפניה למדד המחושב הזה מממשקי API חיצוניים. לדוגמה, 'calcMetric:{calculatedMetricId}'.
|
metricUnit |
enum (MetricUnit )
חובה. הסוג של ערך המדד המחושב.
|
restrictedMetricType[] |
enum (RestrictedMetricType )
פלט בלבד. סוגי הנתונים המוגבלים שנכללים במדד הזה.
|
formula |
string
חובה. ההגדרה של המדד המחושב. המספר המקסימלי של מדדים מותאמים אישית ייחודיים שניתן להפנות אליהם הוא 5. הנוסחאות תומכות בפעולות הבאות: + (חיבור), - (הפחתה), - (שלילית), * (כפל), / (חילוק), () (סוגריים). כל מספר ממשי חוקי יכול להתאים למספר ארוך (מספר שלם של 64 ביט) או למספר כפול (מספר נקודה צפה (floating-point) של 64 ביט). נוסחה לדוגמה: "( customEvent:parameterName + tagPurchaseQuantity ) / 2.0"
|
invalidMetricReference |
boolean
פלט בלבד. אם הערך הוא True, למדד המחושב הזה יש הפניה לא חוקית למדד. כל דבר שנעשה בו שימוש במדד מחושב שערך השירות invalidMetricReference מוגדר כ-True עלול להיכשל, להציג אזהרות או לגרום לתוצאות לא צפויות.
|
MetricUnit
סוגים אפשריים של ייצוג ערך של המדד המחושב.
טיפוסים בני מנייה (enum) |
METRIC_UNIT_UNSPECIFIED |
MetricUnit לא צוין או חסר. |
STANDARD |
המדד הזה משתמש ביחידות ברירת מחדל. |
CURRENCY |
המדד הזה מודד מטבע. |
FEET |
המדד הזה מודד רגל. |
MILES |
המדד הזה מודד מיילים. |
METERS |
המדד הזה מודד מטרים. |
KILOMETERS |
המדד הזה מודד קילומטרים. |
MILLISECONDS |
המדד הזה משמש למדידת אלפיות השנייה. |
SECONDS |
המדד הזה מודד שניות. |
MINUTES |
המדד הזה מודד דקות. |
HOURS |
המדד הזה מודד שעות. |
RestrictedMetricType
תוויות שמציינות את הנתונים במדד מחושב, שנעשה בהם שימוש בשילוב עם תפקידי משתמשים שמגבילים את הגישה למדדים של עלות או הכנסה.
טיפוסים בני מנייה (enum) |
RESTRICTED_METRIC_TYPE_UNSPECIFIED |
סוג לא ידוע או לא צוין. |
COST_DATA |
מדדים כוללים נתוני עלות. |
REVENUE_DATA |
המדד מדווח על נתוני ההכנסות. |
שיטות |
|
יוצרת מדד מחושב. |
|
מוחק מדד מחושב בנכס. |
|
מחפשים מדד מחושב יחיד. |
|
בתיבת הדו-שיח הזו מפורטים מחושביםdMetrics בנכס. |
|
מעדכנות המחושב בנכס. |
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 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. |"]]