快速入门示例

以下是针对 ProductPerformanceView 的示例查询,可返回帐号在过去 30 天内的效果(按 marketingMethodofferId 细分)。您可以通过观看这个简短的示例来熟悉 Merchant Reports API。

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

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

SELECT
  marketingMethod,
  offerId,
  impressions,
  clicks,
  clickThroughRate
FROM ProductPerformanceView
WHERE date BETWEEN '2020-11-01' AND '2020-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
              marketingMethod,
              offerId,
              impressions,
              clicks,
              clickThroughRate
            FROM ProductPerformanceView
            WHERE date BETWEEN '2020-11-01' AND '2020-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"
      }
    }
  ]
}