Sample Post

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.Note: This guide shows the underlying HTTP request as a teaching tool, but we recommend that you use one of the client libraries to submit your requests.

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′”
}

Previousarrow_backOverview

NextMeasure performancearrow_forward

Was this helpful?

Leave a comment

Your email address will not be published. Required fields are marked *