試用 Google Analytics 的 MCP 伺服器。從
GitHub 安裝,詳情請參閱
公告。
即時維度和指標;指標
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Analytics Data API Realtime 方法支援的查詢維度和指標。核心報表方法 (例如 RunReport
) 接受的維度和指標與即時方法不同。
尺寸
您可以在任何資源的報表中要求下列維度。在報表回應中,為維度的資料欄指定 Dimension
資源 name
欄位的「API 名稱」。
API 名稱 |
UI 名稱 |
說明 |
appVersion |
應用程式版本 |
應用程式的 versionName (Android) 或簡短版軟體包版本編號 (iOS)。 |
audienceId |
目標對象 ID |
目標對象的數字 ID。在報表日期範圍內,使用者會記錄於所屬的目標對象中。目前的使用者行為不會影響報表中的歷來目標對象成員。 |
audienceName |
目標對象名稱 |
目標對象的指定名稱。在報表日期範圍內,使用者會記錄於所屬的目標對象中。目前的使用者行為不會影響報表中的歷來目標對象成員。 |
audienceResourceName |
目標對象資源名稱 |
這個目標對象的資源名稱。資源名稱包含集合和資源 ID,可明確識別資源;詳情請參閱「資源名稱」。 |
city |
城市 |
使用者活動的來源城市。 |
cityId |
城市 ID |
使用者活動來源城市的地理區域 ID,是根據 IP 位址推算而得。 |
country |
國家/地區 |
使用者活動的來源國家/地區。 |
countryId |
國家/地區 ID |
使用者活動來源國家/地區的地理區域 ID (根據 IP 位址推算)。格式符合 ISO 3166-1 alpha-2 標準。 |
deviceCategory |
裝置類別 |
裝置類型:桌機、平板電腦或手機。 |
eventName |
事件名稱 |
活動的名稱。 |
minutesAgo |
即時 (數分鐘前) |
事件收集時間與目前時間的間隔 (以分鐘為單位)。00 是目前的分鐘,01 則代表前一分鐘。 |
platform |
平台 |
您應用程式或網站的運作平台,例如網路、iOS 或 Android。如要在報表中判斷串流類型,請同時使用平台和 streamId。 |
streamId |
串流 ID |
應用程式或網站的數字資料串流 ID。 |
streamName |
串流名稱 |
應用程式或網站的資料串流名稱。 |
unifiedScreenName |
網頁標題與畫面名稱 |
系統記錄事件的網頁標題 (網站) 或畫面名稱 (應用程式)。 |
自訂維度
Realtime Data API 可針對以使用者為範圍的自訂維度建立報表。如要進一步瞭解自訂維度,請參閱「自訂使用者屬性」。在 API 報表要求中,自訂維度會依維度的參數名稱和範圍指定。舉例來說,在 Data API 要求中加入 "customUser:last_level"
,即可為參數名稱為 "last_level"
的以使用者為範圍的自訂維度建立報表。如果資源尚未註冊這項以使用者為範圍的自訂維度,這項 API 要求就會失敗。
以下是自訂維度的一般語法。您可以查詢中繼資料 API 方法,列出資源的所有自訂維度。
一般 API 名稱 |
說明 |
customUser:parameter_name |
以使用者為範圍的自訂維度,適用於 parameter_name 。 |
Realtime API 不支援以事件為範圍的自訂維度。
指標
您可以在任何資源的報表中要求下列指標。在 Metric
資源的 name
欄位中,為報表回應中的指標欄指定「API 名稱」。
API 名稱 |
UI 名稱 |
說明 |
activeUsers |
活躍使用者 |
曾造訪您網站或應用程式的不重複使用者人數。 |
eventCount |
事件計數 |
事件數。 |
keyEvents |
重要事件 |
重要事件的計數。將事件標示為重要事件只會影響之後產生的報表資料,不會影響歷來資料。您可以在 Google Analytics 中將任何事件標示為重要事件,而有些事件 (例如 first_open 或 purchase ) 會預設標示為重要事件。 |
screenPageViews |
觀看次數 |
使用者瀏覽的應用程式畫面或網頁數量。重複瀏覽同一個網頁或畫面也會列入計算。(screen_view + page_view 事件)。 |
Realtime API 不支援以事件為範圍的自訂指標。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-29 (世界標準時間)。
[null,null,["上次更新時間:2025-07-29 (世界標準時間)。"],[[["\u003cp\u003eThe Realtime reporting method of the Analytics Data API allows you to query specific dimensions and metrics to analyze real-time user behavior on your app or website.\u003c/p\u003e\n"],["\u003cp\u003eSupported dimensions include user demographics (like city and country), device information, app version, audience data, event details, and user-scoped custom dimensions.\u003c/p\u003e\n"],["\u003cp\u003eYou can use metrics like \u003ccode\u003eactiveUsers\u003c/code\u003e, \u003ccode\u003eeventCount\u003c/code\u003e, \u003ccode\u003escreenPageViews\u003c/code\u003e, and \u003ccode\u003ekeyEvents\u003c/code\u003e to understand real-time user engagement.\u003c/p\u003e\n"],["\u003cp\u003eUnlike Core Reporting methods, the Realtime method uses a different set of dimensions and metrics and doesn't support event-scoped custom dimensions or metrics.\u003c/p\u003e\n"]]],["The Realtime Analytics Data API supports specific dimensions and metrics for querying. Dimensions include `appVersion`, `audienceId/Name/ResourceName`, geographic data (`city/Id`, `country/Id`), `deviceCategory`, `eventName`, `minutesAgo`, `platform`, `streamId/Name`, and `unifiedScreenName`. User-scoped custom dimensions are supported using the `customUser:parameter_name` format. Supported metrics are `activeUsers`, `eventCount`, `keyEvents`, and `screenPageViews`. Event-scoped custom dimensions and metrics are not supported in the Realtime API.\n"],null,["# Realtime Dimensions & Metrics\n\nThe dimensions and metrics supported in queries to the [Realtime method](/analytics/devguides/reporting/data/v1/rest/v1beta/properties/runRealtimeReport) of the Analytics Data API. The\nCore Reporting methods ([`RunReport`](/analytics/devguides/reporting/data/v1/rest/v1beta/properties/runReport)\nfor example) accept a different set of [Dimensions \\& Metrics](/analytics/devguides/reporting/data/v1/api-schema)\nthan the Realtime method.\n\nDimensions\n----------\n\nThe following dimensions can be requested in reports for any property. Specify\nthe \"API Name\" in a [`Dimension`](/analytics/devguides/reporting/data/v1/rest/v1beta/Dimension) resource's `name`\nfield for a column of the dimension in the report response.\n\n| API Name | UI Name | Description |\n|------------------------|----------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `appVersion` | App version | The app's versionName (Android) or short bundle version (iOS). |\n| `audienceId` | Audience ID | The numeric identifier of an Audience. Users are reported in the audiences to which they belonged during the report's date range. Current user behavior does not affect historical audience membership in reports. |\n| `audienceName` | Audience name | The given name of an Audience. Users are reported in the audiences to which they belonged during the report's date range. Current user behavior does not affect historical audience membership in reports. |\n| `audienceResourceName` | Audience resource name | The resource name of this audience. Resource names contain both collection \\& resource identifiers to uniquely identify a resource; to learn more, see [Resource names](//google.aip.dev/122). |\n| `city` | City | The city from which the user activity originated. |\n| `cityId` | City ID | The geographic ID of the city from which the user activity originated, derived from their IP address. |\n| `country` | Country | The country from which the user activity originated. |\n| `countryId` | Country ID | The geographic ID of the country from which the user activity originated, derived from their IP address. Formatted according to ISO 3166-1 alpha-2 standard. |\n| `deviceCategory` | Device category | The type of device: Desktop, Tablet, or Mobile. |\n| `eventName` | Event name | The name of the event. |\n| `minutesAgo` | Realtime minutes ago | The number of minutes ago that an event was collected. 00 is the current minute, and 01 means the previous minute. |\n| `platform` | Platform | The platform on which your app or website ran; for example, web, iOS, or Android. To determine a stream's type in a report, use both platform and streamId. |\n| `streamId` | Stream ID | The numeric data stream identifier for your app or website. |\n| `streamName` | Stream name | The data stream name for your app or website. |\n| `unifiedScreenName` | Page title and screen name | The page title (web) or screen name (app) on which the event was logged. |\n\n### Custom Dimensions\n\nThe Realtime Data API can create reports on User scoped Custom Dimensions. See\n[Custom user properties](//support.google.com/analytics/answer/9269570) to learn\nmore about custom dimensions. Custom dimensions are specified in an API report\nrequest by the dimension's parameter name and scope. For example, include\n`\"customUser:last_level\"` in a Data API request to create a report for the\nUser-scoped Custom Dimension with parameter name `\"last_level\"`. This API\nrequest will fail if the property has not registered this User-scoped Custom\nDimension.\n\nThe following are the general syntax for Custom Dimensions. You can query the\n[Metadata API method](/analytics/devguides/reporting/data/v1/rest/v1beta/properties/getMetadata) to list all\nCustom Dimensions for a Property.\n\n| Generic API Name | Description |\n|-----------------------------|----------------------------------------------------|\n| `customUser:parameter_name` | User-scoped Custom Dimension for `parameter_name`. |\n\nEvent-scoped custom dimensions aren't supported in the Realtime API.\n\nMetrics\n-------\n\nThe following metrics can be requested in reports for any property. Specify the\n\"API Name\" in a [`Metric`](/analytics/devguides/reporting/data/v1/rest/v1beta/Metric) resource's `name` field for\na column of the metric in the report response.\n\n| API Name | UI Name | Description |\n|-------------------|--------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `activeUsers` | Active users | The number of distinct users who visited your site or app. |\n| `eventCount` | Event count | The count of events. |\n| `keyEvents` | Key events | The count of key events. Marking an event as a key event affects reports from time of creation. It doesn't change historic data. You can mark any event as key in Google Analytics, and some events (such as `first_open` or `purchase`) are marked as key events by default. |\n| `screenPageViews` | Views | The number of app screens or web pages your users viewed. Repeated views of a single page or screen are counted. (screen_view + page_view events). |\n\nEvent-scoped custom metrics aren't supported in the Realtime API."]]