是否可以在单个GA4 V1BETA请求中获取页面和设备列表?

发布于 2025-02-09 01:36:59 字数 1615 浏览 3 评论 0原文

我必须制作2 RunrealTimereport请求,一个要获取设备类别,另一个以获取最访问的页面的列表。

我想获得的是通过Mobiledesktop平板电脑的一般命中量,但包括两个维度,返回每个访问的页面和设备类别。

如果我在同一请求中包括devicecategoryunified -screenname尺寸,则数据分组如下:

请求body:

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

响应:

{
    "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"
}

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"
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文