如何通过 Google 分析管理 API 设置 "Advertising Features" 和其他设置?

How to set "Advertising Features" and other settings through Google Analytics Management API?

我正在尝试使用 Google 分析管理 API 来自动管理大量 GA 属性,根据 the docs,这就是它的用途。

但是,我在很多设置上遇到了问题,似乎无法通过 API 获得。 GA 属性 资源的 expected format 可以设置的字段非常有限,似乎不允许指定其他字段。

具体来说,我有兴趣设置 "Advertising features",也就是是否启用人口统计和兴趣报告:

当通过 GA UI 更新此设置时,请求中的字段似乎被称为 demographicsEnabled,但我无法在使用管理 API 时设置或检索此值.

如何通过管理 API 或其他方式设置此值和其他值?如果只能通过 API 设置 属性 的一小部分设置,这对于管理大型帐户似乎有点无用,正如文档声称的那样 - 所以我认为必须有我在这里看不到的一种方式。

据我所知,此功能和许多其他功能在管理 API 中不可用。

How can I set this and other values through the Management API, or other means?

您无法管理 api 您可以更新的字段非常有限。不幸的是,与许多其他 google api 的文档不同,它实际上并没有告诉您哪些字段是可写的。我会向团队提及这一点。

If only a small fraction of the settings for a property can be set through the API, that seems kinda useless for managing large accounts, as the docs claim you can do - so I assume there has to be a way I'm just not seeing here.

API 不适用于管理大型帐户 IMO。它可能仅用于获取有关当前用户有权访问哪些帐户的信息。

我建议您创建一个 feature request 请求能够更新您尝试更新的字段。团队通常对这些类型的请求非常开放。

Link 在这里,我很乐意在下次与团队交谈时将其提请团队注意。