Google Analytics has introduced a new feature called Comparisons in its Data API v1beta. This feature allows users to evaluate subsets of their data side by side. The core reporting methods of the API have been updated to support a new field, comparisons
, which specifies the configuration of comparisons requested in a request.
Users can specify either a basic comparison by providing the dimensionFilter
expression with a request, or use a saved comparison by providing the comparison's resource name in the comparison
field. The getMetadata
method has been updated to list all saved comparisons available for a property under the comparisons
response field. When at least one comparison is specified in a request, the response will contain the comparison
column identifying each comparison.
Currently, saved comparisons can only be created using the Google Analytics UI. Each comparison produces separate rows in the response and is identified by a name. If the name is unspecified, the saved comparisons display name will be used.
The JSON representation of a comparison is as follows:
{
"name": string,
"dimensionFilter": {
object (FilterExpression)
},
"comparison": string
}
The dimensionFilter
object represents a basic comparison, while the comparison
string represents a saved comparison identified by the comparison's resource name.
Image Credit: Brais Calvo Vázquez