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.
API Dữ liệu Google Analytics phiên bản 1 tạo báo cáo cho tài sản Google Analytics.
Các yêu cầu API bắt buộc phải chỉ định giá trị nhận dạng thuộc tính Google Analytics dạng số. Tài liệu và mã mẫu của API Dữ liệu gọi mã nhận dạng này là GA_PROPERTY_ID.
Cách sử dụng
Tất cả các phương thức API Dữ liệu đều yêu cầu bạn phải chỉ định giá trị nhận dạng tài sản Google Analytics bên trong đường dẫn yêu cầu URL ở dạng properties/GA_PROPERTY_ID, chẳng hạn như:
POST https://analyticsdata.googleapis.com/v1beta/properties/GA_PROPERTY_ID:runReport
Nếu bạn đang sử dụng một trong các thư viện ứng dụng Data API, thì bạn không cần phải thao tác theo cách thủ công với đường dẫn URL yêu cầu. Hầu hết các ứng dụng API đều cung cấp tham số property yêu cầu một chuỗi ở dạng properties/GA_PROPERTY_ID. Hãy xem Hướng dẫn bắt đầu nhanh để biết ví dụ về cách sử dụng thư viện ứng dụng.
Mã cơ sở lưu trú của tôi là gì?
Bạn có thể sử dụng Data API nếu đã định cấu hình báo cáo phân tích trong một trong các sản phẩm sau:
Google Analytics
Google Analytics có nhiều loại Tài sản. Để sử dụng Data API, tài sản phải là tài sản Google Analytics, chứ không phải Universal Analytics. Universal Analytics là phiên bản cũ của Google Analytics và không được API Dữ liệu hỗ trợ.
Nếu phần Cài đặt tài sản hiển thị "MÃ TÀI SẢN" dạng số, chẳng hạn như "123...", thì đó là mã số của tài sản Google Analytics.
Firebase
Nếu đã liên kết Google Analytics với Firebase, bạn sẽ thấy dữ liệu phân tích cho dự án của mình trong Firebase. Để tìm hiểu thêm về cách liên kết, hãy xem bài viết Liên kết Google Analytics với Firebase.
Cách xác định tài sản Google Analytics cho một dự án Firebase:
Trang tích hợp Google Analytics sẽ hiển thị "Mã tài sản" dạng số, chẳng hạn như "123...". Đây là mã nhận dạng gồm các chữ số của tài sản Google Analytics.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-07-26 UTC."],[[["\u003cp\u003eThe Google Analytics Data API v1 allows you to access Google Analytics property data using a numeric property identifier (\u003ccode\u003eGA_PROPERTY_ID\u003c/code\u003e).\u003c/p\u003e\n"],["\u003cp\u003eYou can find your \u003ccode\u003eGA_PROPERTY_ID\u003c/code\u003e in the Property Settings of your Google Analytics, Firebase, or AdMob account.\u003c/p\u003e\n"],["\u003cp\u003eUniversal Analytics properties are not supported by the Data API; use the Google Analytics Reporting API v4 instead.\u003c/p\u003e\n"],["\u003cp\u003eClient libraries simplify API usage by providing a \u003ccode\u003eproperty\u003c/code\u003e parameter, eliminating the need to manually manipulate request URLs.\u003c/p\u003e\n"]]],["The Google Analytics Data API v1 requires a numeric property identifier (`GA_PROPERTY_ID`) to generate reports. This ID is specified in the API request URL as `properties/GA_PROPERTY_ID`. You can find your property ID in Google Analytics' Property Settings, Firebase's Google Analytics Integration page, or by navigating from AdMob to Firebase. The Data API only supports Google Analytics properties, not Universal Analytics properties which uses the Google Analytics Reporting API v4.\n"],null,["# Property ID\n\nThe Google Analytics Data API v1 produces reports for [Google Analytics\nproperties](//support.google.com/analytics/answer/9304153#property).\nAPI requests are required to specify a numeric Google Analytics\nproperty identifier. The documentation and sample code of the Data API refer to\nthis ID as `GA_PROPERTY_ID`.\n\nUsage\n-----\n\nAll Data API methods require the Google Analytics property identifier to be\nspecified inside a URL request path in the form of `properties/GA_PROPERTY_ID`,\nsuch as: \n\n POST https://analyticsdata.googleapis.com/v1beta/properties/GA_PROPERTY_ID:runReport\n\nIf you are using one of the [Data API client libraries](/analytics/devguides/reporting/data/v1/client-libraries), there\nis no need to manipulate the request URL path manually. Most API clients\nprovide a `property` parameter that expects a string in the form of\n`properties/GA_PROPERTY_ID`. See [Quick start guide](/analytics/devguides/reporting/data/v1/quickstart-client-libraries)\nfor examples of using the client libraries.\n\nWhat is my property ID?\n-----------------------\n\nYou can use the Data API if you have configured analytics reports in either of\nthe following products:\n\n### Google Analytics\n\nGoogle Analytics has multiple types of Properties. To use the Data API, a\nproperty must be a Google Analytics property, as opposed to Universal\nAnalytics. Universal Analytics is an older version of Google Analytics and is\nnot supported by the Data API.\n\nTo determine a Google Analytics property ID:\n\n1. Visit Google Analytics at \u003chttps://analytics.google.com/\u003e.\n2. Select Admin.\n3. Select the Property.\n4. Select Property Settings.\n\nIf the Property Settings shows a numeric \"PROPERTY ID\" such as \"123...\", this\nis the numeric ID of your Google Analytics property.\n| **Note:** If the Property Settings shows a \"Tracking ID\" such as \"UA-123...-1\", this Property is a Universal Analytics property, and the Analytics data for that property cannot be reported on in the Data API. For that property, you can use the [Google Analytics Reporting API v4](/analytics/devguides/reporting/core/v4) to produce analytics data reports.\n\n### Firebase\n\nIf you have linked Google Analytics to Firebase, you will see analytics data for\nyour project in Firebase. To learn more about linking, see [Link Google\nAnalytics to Firebase](//support.google.com/analytics/answer/9289234).\n\nTo determine the Google Analytics property for a Firebase project:\n\n1. Visit the Firebase console at \u003chttps://console.firebase.google.com/\u003e.\n2. Select your project.\n3. Select Project settings.\n4. Select Integrations.\n5. Select your Google Analytics Integration.\n\nThe Google Analytics Integration page will show a numeric \"Property ID\" such as\n\"123...\". This is the numeric ID of your Google Analytics property.\n\n### AdMob\n\nIf you have [enabled user metrics](//support.google.com/admob/answer/9263723)\nand\n[linked your apps to Firebase](//support.google.com/admob/answer/6383165)\nin AdMob, you will see user metrics in AdMob for your app.\n| **Note:** Currently, linking your AdMob app to Firebase and adding the Google Analytics for Firebase SDK to your app are optional. However, with the [upcoming changes to the collection of user metrics](//support.google.com/admob/answer/13973847) in late 2023, linking to Firebase and adding the Analytics SDK will be required to collect [user metrics for AdMob](//support.google.com/admob/answer/9281746) as well as to [explore and work with this data](//firebase.google.com/docs/admob/analytics-and-firebase).\n\nTo determine the Google Analytics property for an AdMob app:\n\n1. Visit AdMob at \u003chttps://apps.admob.com/\u003e.\n2. Select your app.\n3. Select App Overview.\n4. Select \"FIREBASE DASHBOARD\".\n5. Follow the above Firebase instructions starting with \"Select Project settings.\""]]