The Master time period
Defining a fixed date range
Defining a relative date range
There are broadly speaking three ways to define a time period within a Query in Analytics Canvas:
By default, the time period for any new query is set as "linked to master time period":
This means that the query will use whatever time period is set in the upper left hand corner of the Analytics Canvas interface:
The master time period can be fixed, or relative. If it is relative, for example "Last 3 months" then it needs a reference date time from which to work- by default this is the current date time- the time at which the canvas is run. But you can also specify a fixed date time- this lets you run a canvas with a relative date. For example, if you run "Last 3 months" on May 15, then the months used will be February, March and April. But if you change the reference date to April 15, then the three months used will be January, February and March, regardless of the current date.
To change the reference date click on the large drop down arrow to the far right of the master time period area:
If you do not want your query to use the master date range, then by selecting the "Set specific time period" radio button in the query, it is possible to instead define a new time period for the query.
In cases where there is a very large amount of data, Google Analytics will return only a sampled result set- it will use a statistical estimate, and report a confidence interval for each metric. Often it is possible to avoid this sampling, by partitioning the query so that multiple requests are made, each request not exceeding the data limit at which sampling occurs.
One trigger of sampling is if a query includes more than 500,000 sessions and is not one of the pre-aggregated queries. Using an advanced segment or filter in a query will generally mean that sampling will occur if the 500,000 sessions are exceeded.
For example, trying to query data for six months may result in sampling, but doing 6 queries, one for each month, might not require sampling because each month does not contain enough data to trigger it. It is then possible to combine the data from the 6 queries into the result set required.
Analytics Canvas does this automatically. By selecting the number of partitions in a query, or the maximum number of days in a partition, the query will be broken down into multiple queries, and then the results from all those queries will be aggregated.
For example, if you know that your weekly traffic is always less than 500,000 sessions, then to ensure that no more than 7 days are included in a partition, configure partitioning as follows:
The smallest time span that the Google API allows is one day, so the number of partitions for any given query must not exceed the number of days in the date range required, using the Automatic selection allows you to change the date range without worrying about this.
The following metrics are not allowed when partitioning, as they will not return valid results:
Instead, use only metrics that can be aggregated. Then, after the partitioned query is complete, use a calculation block to do the calculation (for example, rather than using bounceRate, use sessions and bounces, then divide).
The above types of metrics are a problem because partitioning will be aggregating multiple result sets from Google Analytics. For example, if you include users (previously called Visitors) in a query, and a visitor has visited in January, and March, a single query of Jan. 1 to March 31 will show one unique visitor. But a partitioned query, with 3 partitions for the same period will show two visitors (because the API will count the visitor once during the response for the January API request, and once for the March API request. Because the information that Google uses to determine unique visitors is not available via the API, there is no way to resolve this.
To define a fixed date range, simply select "Fixed" and set the start and end date.
Relative date ranges recalculate each time the canvas is run, using the current date on the computer to determine the start and end date for the query.