快速入門導覽課程範例

以下是 product_performance_view 的查詢範例,可依 marketing_methodoffer_id 區隔,傳回帳戶過去 30 天的成效。您可以試試這個簡單範例,熟悉 Merchant Reports API。

您必須具備成效和洞察角色,才能擷取這份報表。詳情請參閱規定

如要提出要求,請將下列 Merchant Center Query Language 陳述式傳遞至 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 要求網址

這項要求包含 HTTP POST,可將資料傳送至 Merchant Reports API 伺服器,網址如下:

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"
      }
    }
  ]
}