https://developers.google.com/analytics/devguides/reporting/core/v4/rest/v4/reports/batchGet
This gist is for doing some batch query testing against GA. The data we need is:
Page level
- pageviews, users, newUsers =>
pageview-query.js
setting
pageSize
to100
to get thenextPageToken
in the response users = "The total number of users for the requested time period" newUsers = "The number of sessions marked as a user's first sessions"
- downloads =>
download_query.js
setting
pageSize
to100
to get thenextPageToken
in the response
Hoping we can filter on the eventCategory
or eventAction
so we can do more targeted querying
Site level
- users, newUsers =>
sitewide-query.js
setting
pageSize
to100
to get thenextPageToken
in the response
- unique_visitors
- returning_visitors
- We can set the
pageSize
up to10000
- Any additional results not returned can be accessed by sending another query using the
nextPageToken
from the response as thepageToken
in the next request
- Can we get pageviews, visitors (both types) and downloads back in a single query? Probably not downloads.. but worth a shot. Maybe if we send downloads as a virtual pageview??
- How do we calculate "unique_visitors" and "returning_visitors" from the GA metrics
newUsers
andusers
?? unique_visitors
==users
?returning_visitors
==users - newUsers
?