Reputation: 21
I am trying to retrieve all sessions and all events in a single query. However, the query below will only return sessions if they also have events. Is there a way to get all sessions even if they don't have events.
GaData gaResults = analytics.data().ga().get("ga:" + profileId, processDate, processDate, "ga:sessions,ga:bounces")
.setDimensions("ga:date,ga:source,ga:medium,ga:campaign,ga:eventCategory,ga:eventAction,ga:eventLabel")
.setSort("-ga:date")
.setMaxResults(5000)
.setStartIndex(start_index)
.execute();
Upvotes: 2
Views: 620
Reputation: 30461
What you're asking for is not possible with the way the Core Reporting API v3 works.
When you ask the API for a dimension, it won't return any rows if it doesn't have a value for that dimension. Sometime the API will return the value "(not set)", but this is only for dimensions where it makes sense to do, e.g. ga:browser
or ga:city
where clearly a value could apply but the value may not be known. For other dimensions it wouldn't make sense to do that, e.g. ga:socialAction
since obviously not every hit contains a social action.
I'm curious to know what you even expect the results to look like for the request you're making? What would the event category, action, and label be for a session if that session didn't contain any event hits?
Upvotes: 2