Using the google analytics portal, i can check the previous and next page path for a given path (for an example, see below) [ Behavior > Site Content > All Pages > Navigation Summary)
How can I access path of all pages, and then for each of these pages the previous and next pages path via the API? The API supports ga:previousPagePath, but nextPagePath is deprecated.
Here is a snippet of my source code (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)
As 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']
Note: ga:nextPagePath
is deprecated and returns the same value as ga:pagePath
. Thus it is up to you to reconnect the flow of /path1 -> /path2 -> /path3