The configuration contains parts of other analysis variants configurations. Meaning that, for example, the Time Series configuration below contains sorting information on Page Impressions and Visits, which is relevant for the normal table view only. All other analysis variant-specific configurations are part of the viewMode property. Time series relevant metrics are identified by the property inTimeSeries: true.

In the code blocks below, be sure to read all comments for additional relevant information.


Configuration

{
    "resultType": "DATA_ONLY",
    "queryObject": {
        "columns": [
            {
                "name": "pages",
                "scope": "OBJECT",
                "context": "PAGE",
                "variant": "NORMAL",
                "lowerLimit": 1,
                "upperLimit": 20
            },
            {
                "name": "pages_pageImpressions",
                "columnPeriod": "ANALYSIS",
                "sortDirection": "DESCENDING",
                "sortIndex": 1,
                "scope": "OBJECT",
                "context": "PAGE",
                "variant": "NORMAL",
                "inTimeSeries": true
            },
            {
                "name": "visits",
                "columnPeriod": "ANALYSIS",
                "scope": "OBJECT",
                "context": "SESSION",
                "variant": "NORMAL",
                "inTimeSeries": true
            },
            {
                "name": "pages_durationAvg",
                "columnPeriod": "ANALYSIS",
                "scope": "OBJECT",
                "variant": "NORMAL"
            },
            {
                "name": "visits_bounceRate",
                "columnPeriod": "ANALYSIS",
                "scope": "OBJECT",
                "variant": "NORMAL"
            },
            {
                "name": "pages_exitRate",
                "columnPeriod": "ANALYSIS",
                "scope": "OBJECT",
                "variant": "NORMAL"
            }
        ],
        "viewMode": {
            "active": "timeSeries",
            "timeSeries": {
                "timeName": "time_days",
                "values": [
                    "Search",
                    "Home",
                    "Cart"
                ],
                "top": 3,
                "viewType": "top"
            }
        },
        "variant": "LIST",
        "predefinedContainer": {
            "filters": [
                {
                    "name": "time_range",
                    "filterPredicate": "BETWEEN",
                    "connector": "AND",
                    "caseSensitive": false,
                    "context": "NONE",
                    "value1": "2023-02-27 00:00:00",
                    "value2": "2023-03-27 00:00:00"
                }
            ],
            "containers": []
        }
    }
}
CODE

Response

Due to the nature of this analysis variant, the request and response columns differ. The time series response is a non-time dimension-based analysis transformed into a time-based analysis, with metrics filtered by the selected time series dimension values. For example, a page analysis with selected time series values "Page A" and "Page B" with Visits on Days becomes a "Days" analysis, with one Visit metric filtered on "Page A" and another Visit metric filtered on "Page B".

Important Properties:

In order to be able to construct a proper table from the result, individual metrics need to be grouped. Imagine the request contains two metrics and you must determine which request column belongs to which metric. For this purpose groupBy and groupByIndex properties have been added.

  • groupBy
    • Determines the base metric by the alias, not the name. The request could contain metrics with identical names or identical arrange types, requiring the alias with an index.
  • groupByIndex:
    • Determines the column position within the base metric

Example Response

From this example, Page Impressions will be given the alias "page_impressions".  You can see which columns are grouped under Page Impressions by looking for "groupBy": "page_impressions|0". The groupByIndex shows the order of the columns, so Search is "groupByIndex": 0, Home is "groupByIndex": 1, and Cart is "groupByIndex": 2.

{
    "calculationDataType": "RAW_DATA",
    "rows": [
        [
            "20230227",
            230,
            173,
            113,
            230,
            171,
            113
        ],
        [
            "20230228",
            229,
            164,
            111,
            229,
            162,
            111
        ],
..
        [
            "20230229",
           	339,
            475,
            135,
            379,
            333,
            1095
        ]
    ],
    "rowCount": 28,
    "rowCountTotal": 28,
    "headers": [
        {
            "alias": "time_id_categories_t_year_month_day|0",
            "arrangeType": "time_id_categories_t_year_month_day",
            "name": "time_days",
            "metric": false,
            "dimension": true,
            "sortIndex": 1,
            "sortDirection": "ASCENDING"
        },
        {
            "alias": "page_impressions|0",
            "arrangeType": "page_impressions",
            "name": "pages_pageImpressions",
            "metric": true,
            "dimension": false,
            "viewModeDimension": "pages",
            "viewModeDimensionValue": "search",
            "groupByIndex": 0,
            "groupBy": "page_impressions|0"
        },
        {
            "alias": "page_impressions|1",
            "arrangeType": "page_impressions",
            "name": "pages_pageImpressions",
            "metric": true,
            "dimension": false,
            "viewModeDimension": "pages",
            "viewModeDimensionValue": "home",
            "groupByIndex": 1,
            "groupBy": "page_impressions|0"
        },
        {
            "alias": "page_impressions|2",
            "arrangeType": "page_impressions",
            "name": "pages_pageImpressions",
            "metric": true,
            "dimension": false,
            "viewModeDimension": "pages",
            "viewModeDimensionValue": "cart",
            "groupByIndex": 2,
            "groupBy": "page_impressions|0"
        },
        {
            "alias": "visits|0",
            "arrangeType": "visits",
            "name": "visits",
            "metric": true,
            "dimension": false,
            "viewModeDimension": "pages",
            "viewModeDimensionValue": "search",
            "groupByIndex": 0,
            "groupBy": "visits|0"
        },
        {
            "alias": "visits|1",
            "arrangeType": "visits",
            "name": "visits",
            "metric": true,
            "dimension": false,
            "viewModeDimension": "pages",
            "viewModeDimensionValue": "home",
            "groupByIndex": 1,
            "groupBy": "visits|0"
        },
        {
            "alias": "visits|2",
            "arrangeType": "visits",
            "name": "visits",
            "metric": true,
            "dimension": false,
            "viewModeDimension": "pages",
            "viewModeDimensionValue": "cart",
            "groupByIndex": 2,
            "groupBy": "visits|0"
        }
    ],
    "columnCount": 7,
    "information": [],
    "warnings": [],
    "timerange": [
        "2023-02-27 00:00:00",
        "2023-03-27 00:00:00"
    ],
    "timestamp": "2023-03-27T18:51:03.744+0100"
}
CODE