Is it possible to get the list of pages and devices in a single GA4 v1beta request?

Viewed 35

I'm having to make 2 runRealtimeReport requests, one to get the device category and another to get the list of the most accessed pages.

What I would like to get is the general amount of hits to the site via mobile, desktop and tablet, but including the two dimensions, return the pages and the device category of each access.

If I include the deviceCategory and unifiedScreenName dimensions in the same request, the data is grouped as shown in the example below:

Request body:

{
  "metrics": [
    {
      "name": "activeUsers"
    }
  ],
  "dimensions": [
    {
      "name": "deviceCategory"
    },
    {
      "name": "unifiedScreenName"
    }
  ],
  "limit": 2
}

Response:

{
    "dimensionHeaders": [
        {
            "name": "deviceCategory"
        },
        {
            "name": "unifiedScreenName"
        }
    ],
    "metricHeaders": [
        {
            "name": "activeUsers",
            "type": "TYPE_INTEGER"
        }
    ],
    "rows": [
        {
            "dimensionValues": [
                {
                    "value": "mobile"
                },
                {
                    "value": "Title page 01"
                }
            ],
            "metricValues": [
                {
                    "value": "9"
                }
            ]
        },
        {
            "dimensionValues": [
                {
                    "value": "mobile"
                },
                {
                    "value": "Title Page 2"
                }
            ],
            "metricValues": [
                {
                    "value": "3"
                }
            ]
        }
    ],
    "rowCount": 16,
    "kind": "analyticsData#runRealtimeReport"
}
0 Answers
Related