Date ranges

  • The Merchant API is the new version of the Content API for Shopping and represents the future of the platform.

  • All Merchant Center Query Language requests for metrics require a segments.date condition in the WHERE clause to specify the desired time period for performance data retrieval.

  • Date ranges can be specified using custom ISO 8601 formatted dates or relative date ranges like LAST_30_DAYS using DURING in the WHERE clause.

The Merchant Center Query Language lets you specify a date range using a custom or relative date range. All requests for metrics must include a condition for segments.date in theWHERE clause to indicate the time period from which you want to retrieve your performance data.

Custom date range

You can specify dates in ISO 8601(YYYY-MM-DD) format:

segments.date BETWEEN '2021-01-01' AND '2021-01-31'

OR:

segments.date >= '2021-01-01' AND segments.date <= '2021-01-31'

You can define date strings with either single quotes (') or double quotes ("). However, you must be consistent; for example: "2021-01-01' is not a valid date string.

Relative date range

In addition to custom date ranges, you can specify a relative date range such as LAST_30_DAYS or THIS_MONTH by using DURING instead of BETWEEN and AND:

WHERE segments.date DURING LAST_30_DAYS

Check out the Merchant Center Query Language grammar for the list of available relative date ranges.