1

我正在使用 management().goals() API 循环访问 Google Analytics 帐户配置文件,并发现为每个目标创建了哪些目标,以了解我可以获取哪些数据。得到一个有效的服务实例后,我可以提出请求,goals().list() 无法抱怨缺少 webPropertyId 参数:

# not including the ServiceAccountCredentials setup here
from apiclient.discovery import build
service = build('analytics', 'v3', http=http)
service.management().goals().list(accountId=account_id, webPropertyId='~all', profileId=profile_id)

最后一行失败:

googleapiclient.errors.HttpError: <HttpError 400 when requesting https://www.googleapis.com/analytics/v3/management/accounts/nnnnnnnnn/webproperties/%7Eall/profiles/nnnnnnnnn/goals?alt=json returned "webPropertyId must be specified.">

[为了隐私,我用 nnnnnnnnn 替换了 /accounts/ 和 /profiles/ 之后的帐户/个人资料编号;真正的错误有数字]

相关位:webPropertyId must be specified.

我肯定提供了webPropertyId参数,如果我删除它,我会得到一个不同的错误:

TypeError: Missing required parameter "webPropertyId"

我可以成功地请求从管理 a​​pi 中提取其他元数据和用户信息以及分析数据。这里可能出了什么问题?我是否不允许在~all这里使用该值并且必须更具体?

4

1 回答 1

1

作品:

GET https://www.googleapis.com/analytics/v3/management/accounts/~all/webproperties/~all/profiles/~all/goals

也有效

GET https://www.googleapis.com/analytics/v3/management/accounts/~all/webproperties/~all/profiles/73835159/goals

不工作。

GET https://www.googleapis.com/analytics/v3/management/accounts/41967536/webproperties/~all/profiles/73835159/goals

回复:

{"error":{"errors":[{"domain":"global","reason":"badRequest","message":"webPropertyId must be specified."}],"code":400,"message":"webPropertyId must be specified."}}

我将把这称为错误 目标,所有结果都会导致提交错误错误报告,我将在下周与团队提出。

于 2017-07-06T10:35:58.977 回答