Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Berikut adalah contoh kueri ke MerchantPerformanceView yang menampilkan performa akun Anda selama 30 hari terakhir, yang disegmentasikan menurut program dan offer_id. Anda dapat mencoba contoh cepat ini untuk memahami layanan Reports.
Klik Run untuk mencoba contoh di API Explorer. Setelah Anda mengklik
Run, perbarui placeholder ID penjual dengan ID penjual Anda sendiri di
URL permintaan. Anda dapat mengubah kueri. Seluruh kueri harus tetap berada dalam satu baris agar dapat berfungsi dengan API Explorer.
URL permintaan HTTP
Permintaan terdiri dari HTTP POST ke server Content API for Shopping di
URL berikut:
Berikut contoh lengkap yang menunjukkan definisi laporan di atas yang disertakan dalam
permintaan POST HTTP:
POST/v2.1/merchantId/reports/searchHTTP/1.1Host:shoppingcontent.googleapis.comUser-Agent:curlContent-Type:application/jsonAccept:application/jsonAuthorization:Bearer access tokenParameters:{"query":"SELECT segments.program, segments.offer_id, metrics.impressions, metrics.clicks, metrics.ctr FROM MerchantPerformanceView WHERE segments.date BETWEEN '2020-11-01' AND '2020-11-30'"}
[null,null,["Terakhir diperbarui pada 2025-08-13 UTC."],[[["\u003cp\u003eThe Merchant API is the new version of the Content API for Shopping and represents the future of the platform.\u003c/p\u003e\n"],["\u003cp\u003eYou can use the Merchant API to retrieve performance data, such as impressions, clicks, and CTR, segmented by program and offer ID.\u003c/p\u003e\n"],["\u003cp\u003eA sample query is provided to demonstrate how to retrieve performance data for the last 30 days using the \u003ccode\u003eMerchantPerformanceView\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eIt's recommended to use one of the client libraries instead of directly making HTTP requests to the Content API for Shopping.\u003c/p\u003e\n"]]],["The beta version of the Merchant API, the new Content API for Shopping, is introduced. To use the `Reports` service, users with the Reporting manager role can query the `MerchantPerformanceView` for account performance. A sample query using Merchant Center Query Language is provided to retrieve data on `program`, `offer_id`, `impressions`, `clicks`, and `ctr` between '2020-11-01' and '2020-11-30'. Users can run the sample via the API Explorer, updating the merchant ID and modifying the query.\n"],null,["# Example\n\nHere's a sample query to the `MerchantPerformanceView` that returns the\nperformance of your account over the last 30 days, segmented by `program` and\n`offer_id`. You can try this quick example to get familiar with the `Reports` service.\n\nYou need the [Reporting manager\nrole](//support.google.com/merchants/answer/11935402) to retrieve this report.\n\nTo make the request, pass the following Merchant Center Query\nLanguage statement to the\n[`reports.search`](/shopping-content/reference/rest/v2.1/reports/search)\nmethod: \n\n SELECT\n segments.program,\n segments.offer_id,\n metrics.impressions,\n metrics.clicks,\n metrics.ctr\n FROM MerchantPerformanceView\n WHERE segments.date BETWEEN '2020-11-01' AND '2020-11-30'\n\n[Run](https://developers.google.com/shopping-content/reference/rest/v2.1/reports/search?apix=true&apix_params=%7B%22merchantId%22%3A0%2C%22resource%22%3A%7B%22query%22%3A%22SELECT%20%20segments.program%2C%20%20segments.offer_id%2C%20%20metrics.impressions%2C%20%20metrics.clicks%2C%20%20metrics.ctr%20FROM%20MerchantPerformanceView%20WHERE%20segments.date%20BETWEEN%20%272020-11-01%27%20AND%20%272020-11-30%27%22%7D%7D)\n\nClick **Run** to try the sample in the **API Explorer** . After you click\n**Run** , update the merchant ID placeholder to your own merchant ID in the\nrequest URL. You can modify the query. The full query must remain on one line to\nwork with the **API explorer**.\n| **Note:** This guide shows the underlying HTTP request as a teaching tool, but we recommend that you use one of the [client libraries](/shopping-content/guides/libraries) to submit your requests.\n\nHTTP request URL\n----------------\n\nThe request consists of an HTTP POST to the Content API for Shopping server at\nthe following URL: \n\n```text\nhttps://shoppingcontent.googleapis.com/content/v2.1/merchantId/reports/search\n```\n\nComplete HTTP request sample\n----------------------------\n\nHere is a complete example showing the report definition above enclosed within\nan HTTP POST request: \n\n```http\nPOST /v2.1/\u003cvar class=\"edit\" translate=\"no\"\u003emerchantId\u003c/var\u003e/reports/search HTTP/1.1\nHost: shoppingcontent.googleapis.com\nUser-Agent: curl\nContent-Type: application/json\nAccept: application/json\nAuthorization: Bearer \u003cvar class=\"edit\" translate=\"no\"\u003eaccess token\u003c/var\u003e\n\nParameters:\n{\n \"query\" : \"SELECT segments.program, segments.offer_id, metrics.impressions,\n metrics.clicks, metrics.ctr\n FROM MerchantPerformanceView\n WHERE segments.date BETWEEN '2020-11-01' AND '2020-11-30'\"\n}\n```"]]