Hãy thử máy chủ MCP cho Google Analytics. Cài đặt từ
GitHub và xem
thông báo để biết thêm thông tin chi tiết.
Phương diện và chỉ số theo thời gian thực
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Các phương diện và chỉ số được hỗ trợ trong các truy vấn đến phương thức Theo thời gian thực của Analytics Data API. Các phương thức Báo cáo cốt lõi (ví dụ: RunReport
) chấp nhận một nhóm Phương diện và chỉ số khác với phương thức Theo thời gian thực.
Kích thước
Bạn có thể yêu cầu các phương diện sau trong báo cáo cho bất kỳ tài sản nào. Chỉ định "Tên API" trong trường name
của tài nguyên Dimension
cho một cột của phương diện trong phản hồi báo cáo.
Tên API |
Tên giao diện người dùng |
Mô tả |
appVersion |
Phiên bản ứng dụng |
Tên phiên bản của ứng dụng (Android) hoặc phiên bản của gói dạng ngắn (iOS). |
audienceId |
ID đối tượng |
Giá trị nhận dạng dạng số của Đối tượng. Người dùng được báo cáo trong các đối tượng mà họ thuộc về trong phạm vi ngày của báo cáo. Hành vi hiện tại của người dùng không ảnh hưởng đến tư cách thành viên trước đây của đối tượng trong báo cáo. |
audienceName |
Tên đối tượng |
Tên của một Đối tượng. Người dùng được báo cáo trong các đối tượng mà họ thuộc về trong phạm vi ngày của báo cáo. Hành vi hiện tại của người dùng không ảnh hưởng đến tư cách thành viên trước đây của đối tượng trong báo cáo. |
audienceResourceName |
Tên tài nguyên cho đối tượng |
Tên tài nguyên của đối tượng này. Tên tài nguyên chứa cả mã nhận dạng tập hợp và tài nguyên để xác định duy nhất một tài nguyên; để tìm hiểu thêm, hãy xem phần Tên tài nguyên. |
city |
Thành phố |
Thành phố bắt nguồn hoạt động của người dùng. |
cityId |
Mã thành phố |
Mã địa lý của thành phố nơi bắt nguồn hoạt động của người dùng, được lấy từ địa chỉ IP của họ. |
country |
Quốc gia |
Quốc gia nơi bắt nguồn hoạt động của người dùng. |
countryId |
Mã quốc gia |
Mã địa lý của quốc gia nơi bắt nguồn hoạt động của người dùng, được lấy từ địa chỉ IP của họ. Được định dạng theo tiêu chuẩn ISO 3166-1 alpha-2. |
deviceCategory |
Danh mục thiết bị |
Loại thiết bị: Máy tính để bàn, Máy tính bảng hoặc Điện thoại di động. |
eventName |
Tên sự kiện |
Tên của sự kiện. |
minutesAgo |
Phút trước theo thời gian thực |
Số phút trước khi một sự kiện được thu thập. 00 là phút hiện tại và 01 là phút trước đó. |
platform |
Nền tảng |
Nền tảng mà ứng dụng hoặc trang web của bạn đã chạy; ví dụ: web, iOS hoặc Android. Để xác định loại luồng trong báo cáo, hãy sử dụng cả nền tảng và streamId. |
streamId |
Mã luồng |
Giá trị nhận dạng luồng dữ liệu dạng số cho ứng dụng hoặc trang web của bạn. |
streamName |
Tên luồng |
Tên luồng dữ liệu cho ứng dụng hoặc trang web của bạn. |
unifiedScreenName |
Tiêu đề trang và tên màn hình |
Tiêu đề trang (web) hoặc tên màn hình (ứng dụng) nơi sự kiện được ghi lại. |
Phương diện tùy chỉnh
Realtime Data API có thể tạo báo cáo về Phương diện tuỳ chỉnh ở phạm vi người dùng. Hãy xem phần Thuộc tính người dùng tuỳ chỉnh để tìm hiểu thêm về phương diện tuỳ chỉnh. Phương diện tuỳ chỉnh được chỉ định trong yêu cầu báo cáo API theo tên tham số và phạm vi của phương diện. Ví dụ: hãy thêm "customUser:last_level"
vào yêu cầu Data API để tạo báo cáo cho Phương diện tuỳ chỉnh trong phạm vi người dùng có tên tham số là "last_level"
. Yêu cầu API này sẽ không thành công nếu tài sản chưa đăng ký Phương diện tuỳ chỉnh ở phạm vi người dùng này.
Sau đây là cú pháp chung cho Phương diện tuỳ chỉnh. Bạn có thể truy vấn phương thức Metadata API để liệt kê tất cả Thứ nguyên tuỳ chỉnh cho một Tài sản.
Tên API chung |
Mô tả |
customUser:parameter_name |
Phương diện tuỳ chỉnh ở phạm vi người dùng cho parameter_name . |
Phương diện tuỳ chỉnh ở phạm vi sự kiện không được hỗ trợ trong Realtime API.
Chỉ số
Bạn có thể yêu cầu các chỉ số sau trong báo cáo cho bất kỳ tài sản nào. Chỉ định "Tên API" trong trường name
của tài nguyên Metric
cho một cột của chỉ số trong phản hồi báo cáo.
Tên API |
Tên giao diện người dùng |
Mô tả |
activeUsers |
Số người dùng đang hoạt động |
Số người dùng riêng biệt đã truy cập vào trang web hoặc ứng dụng của bạn. |
eventCount |
Số sự kiện |
Số lượng sự kiện. |
keyEvents |
Sự kiện quan trọng |
Số lượng sự kiện chính. Việc đánh dấu một sự kiện là sự kiện chính sẽ ảnh hưởng đến các báo cáo kể từ thời điểm tạo. Việc này không làm thay đổi dữ liệu trong quá khứ. Bạn có thể đánh dấu bất kỳ sự kiện nào là sự kiện chính trong Google Analytics. Theo mặc định, một số sự kiện (chẳng hạn như first_open hoặc purchase ) sẽ được đánh dấu là sự kiện chính. |
screenPageViews |
Số lượt xem |
Số lượng màn hình ứng dụng hoặc trang web mà người dùng đã xem. Chỉ số này tính cả số lượt xem lặp lại của một trang hoặc màn hình. (số sự kiện screen_view + số sự kiện page_view). |
API theo thời gian thực không hỗ trợ chỉ số tuỳ chỉnh ở phạm vi sự kiện.
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-29 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-29 UTC."],[[["\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."]]