Periods
The format of a period is a list of two strings that represent dates:
{
...
"periods": [
["2021-01-01", "2021-01-31"],
["2021-02-01", "2021-02-28"]
],
...
}
In the above example, two periods are defined. You can use one, two, or more periods. The first period represents January 2021, and the second period represents February 2021. These will be applied to all specified timestamped collections and allow you to query each period using a 0-based index.
For example:
{
"collections": [
"search_console",
"conversion"
],
"periods": [
["2021-01-01", "2021-01-31"],
["2021-02-01", "2021-02-28"]
],
...
}
Both collections are timestamped, and two periods are defined. This enables you to query fields that are prefixed as:
search_console.period_0.field_slug
=> RealKeywords data from January 2021search_console.period_1.field_slug
=> RealKeywords data from February 2021conversion.period_0.field_slug
=> EngagementAnalytics data from January 2021conversion.period_1.field_slug
=> EngagementAnalytics data from February 2021
In the same query, you can query fields from the first period and fields for the second period:
{
"collections": [
"search_console",
"conversion"
],
"periods": [
["2021-01-01", "2021-01-31"],
["2021-02-01", "2021-02-28"]
],
"query": {
"dimensions": [
"web_vitals.field_data.period_0.device"
],
"metrics": [
{
"field": "search_console.period_1.count_clicks",
"name": "Clicks"
},
{
"field": "web_vitals.field_data.period_0.ux_score",
"name": "UX: Score"
}
],
}
}
Updated over 1 year ago
What’s Next