Google Analytics Reporting API (Python) - 如何获取上一页和下一页路径?
Google Analytics Reporting API (Python) - How can I obtain previous and next page path?
使用 google 分析门户,我可以检查给定路径的上一页和下一页路径(例如,见下文)[行为>网站内容>所有页面>导航摘要)
如何访问所有页面的路径,然后通过 API 访问每个页面的上一页和下一页路径?
API 支持 ga:previousPagePath,但不推荐使用 nextPagePath。
这是我的源代码片段 (python)。
DIMENSIONS =['ga:date','ga:hour', 'ga:minute', ??, ??]
METRICS =['ga:pageviews','ga:uniquePageviews', 'ga:sessions', 'ga:avgTimeOnPage']
def get_api_traffic_query(service):
start ='2016-08-24'
end = '2016-08-24'
metrics =','.join(map(str, METRICS))
dimensions =','.join(map(str, DIMENSIONS))
start_index = '1'
segment='sessions::condition::ga:hostname!~mongo|app|help|docs|staging|googleweblight',
return service.data().ga().get(ids=PROFILE_ID,start_date=start,end_date=end,metrics=metrics,dimensions=dimensions,
start_index=start_index)
如DalmTo mentioned just query for the combination of ga:pagePath
and ga:previousPagePath
Dimensions.
DIMENSIONS =['ga:date','ga:hour', 'ga:minute', `ga:pagePath`, `ga:previousPagePath`]
METRICS =['ga:pageviews','ga:uniquePageviews', 'ga:sessions', 'ga:avgTimeOnPage']
注意:ga:nextPagePath
已弃用,returns 与 ga:pagePath
的值相同。因此,您需要重新连接 /path1 -> /path2 -> /path3
的流程
使用 google 分析门户,我可以检查给定路径的上一页和下一页路径(例如,见下文)[行为>网站内容>所有页面>导航摘要)
如何访问所有页面的路径,然后通过 API 访问每个页面的上一页和下一页路径? API 支持 ga:previousPagePath,但不推荐使用 nextPagePath。
这是我的源代码片段 (python)。
DIMENSIONS =['ga:date','ga:hour', 'ga:minute', ??, ??]
METRICS =['ga:pageviews','ga:uniquePageviews', 'ga:sessions', 'ga:avgTimeOnPage']
def get_api_traffic_query(service):
start ='2016-08-24'
end = '2016-08-24'
metrics =','.join(map(str, METRICS))
dimensions =','.join(map(str, DIMENSIONS))
start_index = '1'
segment='sessions::condition::ga:hostname!~mongo|app|help|docs|staging|googleweblight',
return service.data().ga().get(ids=PROFILE_ID,start_date=start,end_date=end,metrics=metrics,dimensions=dimensions,
start_index=start_index)
如DalmTo mentioned just query for the combination of ga:pagePath
and ga:previousPagePath
Dimensions.
DIMENSIONS =['ga:date','ga:hour', 'ga:minute', `ga:pagePath`, `ga:previousPagePath`]
METRICS =['ga:pageviews','ga:uniquePageviews', 'ga:sessions', 'ga:avgTimeOnPage']
注意:ga:nextPagePath
已弃用,returns 与 ga:pagePath
的值相同。因此,您需要重新连接 /path1 -> /path2 -> /path3