Example

Here's a sample query to the MerchantPerformanceView that returns the performance of your account over the last 30 days, segmented by program and offer_id. You can try this quick example to get familiar with the Reports service.

You need the Reporting manager role to retrieve this report.

To make the request, pass the following Merchant Center Query Language statement to the reports.search method:

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'

Run

Click Run to try the sample in the API Explorer. After you click Run, update the merchant ID placeholder to your own merchant ID in the request URL. You can modify the query. The full query must remain on one line to work with the API explorer.

HTTP request URL

The request consists of an HTTP POST to the Content API for Shopping server at the following URL:

https://shoppingcontent.googleapis.com/content/v2.1/merchantId/reports/search

Complete HTTP request sample

Here is a complete example showing the report definition above enclosed within an HTTP POST request:

POST /v2.1/merchantId/reports/search HTTP/1.1
Host: shoppingcontent.googleapis.com
User-Agent: curl
Content-Type: application/json
Accept: application/json
Authorization: Bearer access token

Parameters:
{
  "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'"
}