Google Analytics Data API v1 可为 Google Analytics 媒体资源生成报告。API 请求必须指定一个数字 Google Analytics 媒体资源标识符。Data API 的文档和示例代码将此 ID 称为 GA_PROPERTY_ID。
用法
所有 Data API 方法都要求在网址请求路径中以 properties/GA_PROPERTY_ID 的形式指定 Google Analytics 媒体资源标识符,例如:
POST https://analyticsdata.googleapis.com/v1beta/properties/GA_PROPERTY_ID:runReport
如果您使用的是 Data API 客户端库之一,则无需手动操作请求网址路径。大多数 API 客户端都会提供一个 property 参数,该参数需要 properties/GA_PROPERTY_ID 形式的字符串。如需查看有关如何使用客户端库的示例,请参阅快速入门指南。
我的房源 ID 是什么?
如果您在以下任一产品中配置了分析报告,则可以使用 Data API:
Google Analytics
Google Analytics 有多种媒体资源类型。如需使用 Data API,媒体资源必须是 Google Analytics 媒体资源,而不是 Universal Analytics 媒体资源。Universal Analytics 是 Google Analytics 的旧版,不受 Data API 支持。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-03-10。"],[[["The Google Analytics Data API v1 allows you to access Google Analytics property data using a numeric property identifier (`GA_PROPERTY_ID`)."],["You can find your `GA_PROPERTY_ID` in the Property Settings of your Google Analytics, Firebase, or AdMob account."],["Universal Analytics properties are not supported by the Data API; use the Google Analytics Reporting API v4 instead."],["Client libraries simplify API usage by providing a `property` parameter, eliminating the need to manually manipulate request URLs."]]],["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"]]