Google Analytics API - 检索配置文件/帐户的细分列表

发布于 2024-12-23 11:07:52 字数 500 浏览 1 评论 0原文

我们有多个通过单次登录访问的 Analytics 帐户。我们希望获得对给定帐户有效的自定义细分列表。 GData API (management.segments.list) 返回用户的所有细分,但不包含将细分映射到帐户(实际上是个人资料)的任何信息。

因此,如果您有 10 个帐户,每个帐户有 10 个分段,则当您从 management.segments.list V3.0 获取分段列表时,它会返回 100,其中 90 个将为任何核心分析请求返回 0 次访问(因为请求必须包含个人资料 ID)。

虽然文档通常不清楚,或者在这种情况下链接到 404 URL,但它似乎很完整 - 您只是无法获取对配置文件有效的分段列表,也无法查看分段是在哪个配置文件中创建的。任何人都有任何想法?


我有一个答案,但由于我的积分水平而无法将其发布为答案。事实证明,段和配置文件的所有功能都隐藏在新界面中。切换到旧界面使其可见。因此,分段是在用户级别定义的,并且对于用户有权访问的每个帐户/个人资料显示或隐藏。

We have multiple Analytics accounts accessed by a single login. We would like to get a list of custom segments that are valid for a given account. The GData API (management.segments.list) returns all segments for the user but does not include any information mapping the segments to the accounts (profiles, really).

So, if you have 10 accounts with 10 segments each, when you get the list of segments from management.segments.list V3.0 it returns 100, of which 90 will return 0 visits for any core analytics request (since requests must include a profile id).

While the documentation is normally unclear or links to a 404 URL in this case it seems complete - you just can't get a list of segments that are valid for a profile, nor see which profile a segment was created in. Anyone have any ideas?


I have an answer but couldn't post it as an answer due to my points level. Turns out all the functionality for segments and profiles is hidden in the new interface. Switching to the old interface made it visible. So segments are defined at the user level and either shown or hidden for each account / profile that the user has access to.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

孤单情人 2024-12-30 11:07:52

我找到了一种从 api 获取自定义细分详细信息的简单方法。

首先,您需要具有用户管理访问权限,管理员可能可以轻松做到这一点。

管理细分#设置细分可用性

  • 访问此链接并转至到其中的“设置段可用性”部分。
  • 应用链接中所示的“协作权限”选项。

申请权限后,只需使用您的服务帐户和 Google Analytics API 运行以下链接中的代码。

列出用户的细分

这次您将能够获得自定义细分列表。花了几个小时,希望有帮助。

I found an easy way to get custom segments details from api.

First, you need to have user management access, probably an administrator can easily do that.

Manage Segments#Set Segment availability

  • Visit this link and go to 'Set Segment availability' section in there.
  • Apply 'Collaborate permission' option as shown in the link.

After applying permission, just using your service account and Google Analytics API run the code as in below link.

Listing a User's Segments

This time you will be able to get a list of custom segments. Spent hours on it, hope it helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文