[英]How we should create the credential to connect to google analytics via Python?
I used the google Python example to connect to google analytics and collect all data. 我使用Google Python示例连接到Google Analytics(分析)并收集了所有数据。 I was able to connect and collect data when I use this example, but when I change the
profile_id
to select a different view, I got the following error: 使用此示例时,我能够连接并收集数据,但是当我更改
profile_id
以选择其他视图时,出现以下错误:
was: 是:
profile_id = get_first_profile_id(service)
now: 现在:
profile_id = '68444917
googleapiclient.errors.HttpError: <HttpError 403 when requesting https://www.googleapis.com/analytics/v3/data/ga?ids=ga%3A168847831&start-date=2018-01-01&end-date=2019-02-01&metrics=ga%3Asessions%2Cga%3AtotalEvents%2Cga%3Ausers&dimensions=ga%3AeventAction%2Cga%3Adate%2Cga%3AcontentGroup2%2Cga%3AcontentGroup3&filters=ga%3AeventAction%3D%3DDealer+site&samplingLevel=HIGHER_PRECISION&include-empty-rows=true&start-index=1&max-results=10000&alt=json returned "User does not have sufficient permissions for this profile.">
The admin checked my permission based on questions 1 and 2 and it looks I have access to all views. 管理员根据问题1和2检查了我的许可,看来我有权访问所有视图。
It is needed the permission granted to the created email account by google analytics as mentioned here : 这是需要通过谷歌分析授予创建的电子邮件帐户的权限所提到这里 :
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.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.