次の ProductPerformanceView
に対するサンプルクエリでは、過去 30 日間のアカウントのパフォーマンスが marketingMethod
と offerId
で分類されています。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 リクエストの URL
リクエストは、次の URL の 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"
}
}
]
}