google 分析中每个用户 ID 的页面访问和持续时间
page visit and duration for each user id in google analytics
连接 python 与 google 分析,试图为每个用户 ID 提取原始数据,它访问了哪个页面以及在该页面上花费了多长时间。来自网站的测试代码如下所示,我不知道如何更新此代码。
官方指标网站似乎连一个名为 user-id 的列都没有...
https://ga-dev-tools.appspot.com/dimensions-metrics-explorer/
POST https://analyticsreporting.googleapis.com/v4/reports:batchGet
{
"reportRequests":
[
{
"viewId": "XXXX",
"dateRanges":
[
{"endDate": "2014-11-30", "startDate": "2014-11-01"}
],
"metrics":
[
{"expression": "ga:users"}
],
"dimensions":
[
{"name": "ga:city"}
]
}
]
}
API 没有可用的用户识别维度。如果您有 GA360 并启用了 BigQuery integration, you can extract clientId / userId level information by querying the tables in BigQuery. According to this guide
When you initially link an Analytics reporting view to BigQuery,
Analytics exports 13 months or 10 billion hits (whichever is smaller)
of historical data to BigQuery.
另一个解决方案是create a Custom Dimension of user scope and pass clientId with it in Google Analytics。然后使用API,您将能够获取所需的信息。
连接 python 与 google 分析,试图为每个用户 ID 提取原始数据,它访问了哪个页面以及在该页面上花费了多长时间。来自网站的测试代码如下所示,我不知道如何更新此代码。
官方指标网站似乎连一个名为 user-id 的列都没有... https://ga-dev-tools.appspot.com/dimensions-metrics-explorer/
POST https://analyticsreporting.googleapis.com/v4/reports:batchGet
{
"reportRequests":
[
{
"viewId": "XXXX",
"dateRanges":
[
{"endDate": "2014-11-30", "startDate": "2014-11-01"}
],
"metrics":
[
{"expression": "ga:users"}
],
"dimensions":
[
{"name": "ga:city"}
]
}
]
}
API 没有可用的用户识别维度。如果您有 GA360 并启用了 BigQuery integration, you can extract clientId / userId level information by querying the tables in BigQuery. According to this guide
When you initially link an Analytics reporting view to BigQuery, Analytics exports 13 months or 10 billion hits (whichever is smaller) of historical data to BigQuery.
另一个解决方案是create a Custom Dimension of user scope and pass clientId with it in Google Analytics。然后使用API,您将能够获取所需的信息。