快速入门示例

下面是一个针对 product_performance_view 的查询示例,用于返回您的账号在过去 30 天内的效果数据,按 marketing_methodoffer_id 细分。您可以尝试以下快速示例,熟悉 Merchant Reports API。

您需要拥有“效果和数据分析”角色才能检索此报告。如需了解详情,请参阅要求

如需发出请求,请将以下 Merchant Center 查询语言语句传递给 accounts.reports.search 方法:

SELECT
  marketing_method,
  offer_id,
  impressions,
  clicks,
  click_through_rate
FROM product_performance_view
WHERE date BETWEEN '2023-11-01' AND '2023-11-30'

HTTP 请求网址

该请求包含一个指向以下网址的 Merchant Reports API 服务器的 HTTP POST:

https://merchantapi.googleapis.com/reports/v1beta/accounts/PARENT/reports:search

完整的 HTTP 请求示例

以下完整示例介绍了包含在 HTTP POST 请求中的报告定义:

POST /reports/v1beta/accounts/PARENT/reports:search HTTP/1.1
Host: merchantapi.googleapis.com
User-Agent: curl
Content-Type: application/json
Accept: application/json
Authorization: Bearer

Parameters:
{
  "query" : "SELECT
              marketing_method,
              offer_id,
              impressions,
              clicks,
              click_through_rate
            FROM product_performance_view
            WHERE date BETWEEN '2023-11-01' AND '2023-11-30'"
}

以下是示例响应:

{
  "results": [
    {
      "productPerformanceView": {
        "marketingMethod": "ADS",
        "offerId": "12345",
        "clicks": "38",
        "impressions": "1038",
        "clickThroughRate": "0.3661"
      }
    },
    {
      "productPerformanceView": {
        "marketingMethod": "ADS",
        "offerId": "12346",
        "clicks": "126",
        "impressions": "1126",
        "clickThroughRate": "0.1119"
      }
    },
    {
      "productPerformanceView": {
        "marketingMethod": "ORGANIC",
        "offerId": "12346",
        "clicks": "26",
        "impressions": "526",
        "clickThroughRate": "0.0494"
      }
    },
    {
      "productPerformanceView": {
        "marketingMethod": "ADS",
        "offerId": "12347",
        "clicks": "227",
        "impressions": "1227",
        "clickThroughRate": "0.1850"
      }
    },
    {
      "productPerformanceView": {
        "marketingMethod": "ORGANIC",
        "offerId": "12347",
        "clicks": "12",
        "impressions": "512",
        "clickThroughRate": "0.0234"
      }
    }
  ]
}