Google Analytics Reporting API (Python) -如何获取上一页和下一页路径?


使用google分析门户,我可以检查给定路径的上一页和下一页路径(例如,见下文)[行为>站点内容>所有页面>导航摘要]

?

?

如何通过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)

转载请注明出处:http://www.yinxuebaozhuang.com/article/20230526/1247825.html