You can use the Reports
service to retrieve performance
metrics for your account.
See the metrics
documentation for the
complete list of available metrics.
Requirements
You need the Reporting manager role to retrieve this report.
To give an account the Reporting manager role, use
accounts.update
to
set the reportingManager
field to true
. The Reporting manager role is
equivalent to the Performance and insights role in Merchant Center.
accounts.update
replaces the entire Account
resource. Use accounts.get
to
get the full Account
resource, then provide all fields in your
accounts.update
request so you don't lose information.
Sample query
The following query retrieves the impressions
, clicks
, and ctr
for all
products in your account during a specific 30-day period. To make the request,
pass the following Merchant Center Query Language statement to the
reports.search
method:
SELECT
metrics.impressions,
metrics.clicks,
metrics.ctr
FROM MerchantPerformanceView
WHERE segments.date BETWEEN '2020-12-01' AND '2020-12-30'
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.
You can also segment the metrics in the query for more granular performance reports.
See the Products guide to learn how
to retrieve and filter products with the Reports
service.