The Merchant API offers performance reports, for example
ProductPerformanceView
.
This page explains the structure of performance reports.
Metrics
You can query for metrics (for example, clicks
and impressions
) that you
want returned. You must add a filter on the date range to query the Reports
service for performance data.
Here's a sample query that returns a single row, with the total number of clicks within the specified date range:
SELECT clicks
FROM ProductPerformanceView
WHERE date BETWEEN '2020-12-01' AND '2020-12-21'
You must specify the data you want returned. Wildcards (for example, SELECT
*
) return an error.
The following sample response shows that the merchant has had 4,440 total clicks, across all products, across all marketing methods, between December 1st, 2020 and December 21st, 2020.
{
"results": [
{
"productPerformanceView": {
"clicks": "4,440"
}
}
]
}
Segments
You can use the MCQL to query for segments fields. Segments fields can be
product attributes (for example, offerId
, brand
, and category
) or event
attributes (for example date
and marketingMethod
).
Segments fields act similarly to a GROUP BY
in SQL. Segments fields split the
selected metrics, grouping by each segment in the SELECT
clause.
Here's a sample query that returns clicks per day, in descending order by
clicks
, within the added condition of a date range. Only rows where at least
one requested metric is non-zero are returned.
SELECT
date,
clicks
FROM ProductPerformanceView
WHERE date BETWEEN '2020-12-01' AND '2020-12-03'
ORDER BY clicks DESC
The following sample response shows that the merchant had 1,546 clicks across all products, across all marketing methods, on December 1st, 2020, and 829 clicks across all products, across all marketing methods, on December 2nd, 2020. The merchant had no clicks on December 3rd, 2020, so nothing is returned for that date.
{
"results": [
{
"productPerformanceView": {
"date": {
"year": 2020,
"month": 12,
"day": 1
},
"clicks": "1546"
}
},
{
"productPerformanceView": {
"date": {
"year": 2020,
"month": 12,
"day": 2
},
"clicks": "829"
}
}
]
}