ลองใช้เซิร์ฟเวอร์ MCP สำหรับ Google Analytics ติดตั้งจาก
GitHub และดูรายละเอียดเพิ่มเติมได้ที่
ประกาศ
มิติข้อมูลและเมตริกแบบเรียลไทม์
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
มิติข้อมูลและเมตริกที่รองรับในการค้นหาไปยังเมธอดเรียลไทม์ของ Analytics Data API เมธอดการรายงานหลัก (เช่น RunReport
) ยอมรับชุดมิติข้อมูลและเมตริก
ที่แตกต่างจากเมธอดเรียลไทม์
ขนาด
คุณขอใช้มิติข้อมูลต่อไปนี้ในรายงานสําหรับพร็อพเพอร์ตี้ใดก็ได้ ระบุ "ชื่อ API" ในฟิลด์ name
ของทรัพยากร Dimension
สำหรับคอลัมน์ของมิติข้อมูลในการตอบกลับของรายงาน
ชื่อ API |
ชื่อ UI |
คำอธิบาย |
appVersion |
เวอร์ชันของแอป |
versionName (Android) หรือเวอร์ชัน Bundle (iOS) แบบย่อของแอป |
audienceId |
รหัสกลุ่มเป้าหมาย |
ตัวระบุที่เป็นตัวเลขของกลุ่มเป้าหมาย ระบบจะรายงานผู้ใช้ในกลุ่มเป้าหมายที่ผู้ใช้อยู่ในระหว่างช่วงวันที่ของรายงาน พฤติกรรมของผู้ใช้ในปัจจุบันจะไม่มีผลกับการเป็นสมาชิกกลุ่มเป้าหมายที่ผ่านมาในรายงาน |
audienceName |
ชื่อกลุ่มเป้าหมาย |
ชื่อที่กําหนดของกลุ่มเป้าหมาย ระบบจะรายงานผู้ใช้ในกลุ่มเป้าหมายที่ผู้ใช้อยู่ในระหว่างช่วงวันที่ของรายงาน พฤติกรรมของผู้ใช้ในปัจจุบันจะไม่มีผลกับการเป็นสมาชิกกลุ่มเป้าหมายที่ผ่านมาในรายงาน |
audienceResourceName |
ชื่อทรัพยากรกลุ่มเป้าหมาย |
ชื่อทรัพยากรของกลุ่มเป้าหมายนี้ ชื่อทรัพยากรมีทั้งตัวระบุคอลเล็กชันและตัวระบุทรัพยากรเพื่อระบุทรัพยากรที่ไม่ซ้ำกัน ดูข้อมูลเพิ่มเติมได้ที่ชื่อทรัพยากร |
city |
เมือง |
เมืองที่เกิดกิจกรรมของผู้ใช้ |
cityId |
รหัสเมือง |
รหัสทางภูมิศาสตร์ของเมืองที่เกิดกิจกรรมของผู้ใช้ ซึ่งได้มาจากที่อยู่ IP |
country |
ประเทศ |
ประเทศที่เกิดกิจกรรมของผู้ใช้ |
countryId |
รหัสประเทศ |
รหัสทางภูมิศาสตร์ของประเทศที่เกิดกิจกรรมของผู้ใช้ ซึ่งได้มาจากที่อยู่ IP จัดรูปแบบตามมาตรฐาน ISO 3166-1 alpha-2 |
deviceCategory |
หมวดหมู่ของอุปกรณ์ |
ชนิดของอุปกรณ์: เดสก์ท็อป แท็บเล็ต หรืออุปกรณ์เคลื่อนที่ |
eventName |
ชื่อเหตุการณ์ |
ชื่อเหตุการณ์ |
minutesAgo |
นาทีที่ผ่านมาแบบเรียลไทม์ |
จำนวนนาทีที่ผ่านมานับตั้งแต่รวบรวมเหตุการณ์ 00 คือนาทีปัจจุบัน และ 01 หมายถึงนาทีก่อนหน้า |
platform |
แพลตฟอร์ม |
แพลตฟอร์มที่แอปหรือเว็บไซต์ทำงาน เช่น เว็บ, iOS หรือ Android หากต้องการระบุประเภทของสตรีมในรายงาน ให้ใช้ทั้งแพลตฟอร์มและ streamId |
streamId |
รหัสสตรีม |
ตัวระบุสตรีมข้อมูลที่เป็นตัวเลขสําหรับแอปหรือเว็บไซต์ |
streamName |
ชื่อสตรีม |
ชื่อสตรีมข้อมูลสําหรับแอปหรือเว็บไซต์ |
unifiedScreenName |
ชื่อหน้าและชื่อหน้าจอ |
ชื่อหน้า (เว็บ) หรือชื่อหน้าจอ (แอป) ที่บันทึกเหตุการณ์ |
มิติข้อมูลที่กำหนดเอง
Realtime Data API สร้างรายงานเกี่ยวกับมิติข้อมูลที่กําหนดเองระดับผู้ใช้ได้ ดูข้อมูลเพิ่มเติมเกี่ยวกับมิติข้อมูลที่กำหนดเองได้ที่พร็อพเพอร์ตี้ผู้ใช้ที่กำหนดเอง มิติข้อมูลที่กําหนดเองจะระบุในคําขอรายงาน API
ตามชื่อพารามิเตอร์และขอบเขตของมิติข้อมูล เช่น ระบุ
"customUser:last_level"
ในคำขอ Data API เพื่อสร้างรายงานสําหรับ
มิติข้อมูลที่กําหนดเองระดับผู้ใช้ที่มีชื่อพารามิเตอร์ "last_level"
คำขอ API นี้จะล้มเหลวหากพร็อพเพอร์ตี้ไม่ได้ลงทะเบียนมิติข้อมูลที่กำหนดเองระดับผู้ใช้นี้
ต่อไปนี้คือไวยากรณ์ทั่วไปสำหรับมิติข้อมูลที่กำหนดเอง คุณสามารถค้นหา
เมธอด Metadata API เพื่อแสดงรายการ
มิติข้อมูลที่กําหนดเองทั้งหมดสําหรับพร็อพเพอร์ตี้
ชื่อ API ทั่วไป |
คำอธิบาย |
customUser:parameter_name |
มิติข้อมูลที่กำหนดเองระดับผู้ใช้สำหรับ parameter_name |
API แบบเรียลไทม์ไม่รองรับมิติข้อมูลที่กำหนดเองระดับเหตุการณ์
เมตริก
คุณขอเมตริกต่อไปนี้ได้ในรายงานสำหรับพร็อพเพอร์ตี้ใดก็ได้ ระบุ "ชื่อ API" ในฟิลด์ name
ของทรัพยากร Metric
สำหรับ
คอลัมน์ของเมตริกในการตอบกลับของรายงาน
ชื่อ API |
ชื่อ UI |
คำอธิบาย |
activeUsers |
ผู้ใช้ที่ใช้งานอยู่ |
จํานวนของผู้ใช้ที่ไม่ซ้ำกันซึ่งเข้าชมเว็บไซต์หรือแอปของคุณ |
eventCount |
จำนวนเหตุการณ์ |
จำนวนเหตุการณ์ |
keyEvents |
เหตุการณ์สำคัญ |
จํานวนเหตุการณ์สําคัญ การทําเครื่องหมายเหตุการณ์เป็นเหตุการณ์สําคัญจะส่งผลต่อรายงานนับตั้งแต่เวลาที่สร้าง แต่ไม่ได้เปลี่ยนแปลงข้อมูลย้อนหลัง คุณทําเครื่องหมายเหตุการณ์ใดก็ได้เป็นคีย์ใน Google Analytics และบางเหตุการณ์ (เช่น first_open หรือ purchase ) จะได้รับการทําเครื่องหมายเป็นเหตุการณ์สําคัญโดยค่าเริ่มต้น |
screenPageViews |
ยอดดู |
จำนวนหน้าจอแอปหรือหน้าเว็บที่ผู้ใช้ดู นับการดูหน้าเว็บหรือหน้าจอเดียวซ้ำหลายครั้งด้วย (เหตุการณ์ screen_view + เหตุการณ์ page_view) |
API แบบเรียลไทม์ไม่รองรับเมตริกที่กําหนดเองที่กำหนดขอบเขตระดับเหตุการณ์
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-29 UTC
[null,null,["อัปเดตล่าสุด 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."]]