我们应该如何创建凭证以通过Python连接到Google Analytics(分析)?

时间:2019-02-12 14:54:46

标签: python google-analytics-api credentials

我使用google Python example连接到Google Analytics(分析)并收集了所有数据。使用此示例时,我能够连接并收集数据,但是当我更改b以选择其他视图时,出现以下错误:

是:

profile_id

现在:

profile_id = get_first_profile_id(service)

管理员根据问题12检查了我的许可,看来我有权访问所有视图。

1 个答案:

答案 0 :(得分:0)

需要here所述的Google Analytics(分析)授予创建的电子邮件帐户的权限:

The newly created service account will have an email address that looks similar to:

quickstart@PROJECT-ID.iam.gserviceaccount.com
Use this email address to add a user to the Google analytics view you want to access via the API. For this tutorial only Read & Analyze permissions are needed.