I've just started using the GA API and I'm using the Google Analytics add-on for Sheets to ease the starting up pain with the API and maybe it's worth mentioning. One thing I don't understand are the dimensions' limitations for combining different dimensions together. I'd like to return a result list that has time, deviceCategory, location, pageTitle and then age and/or gender (if the data exists).
So as I increase the amount of dimensions to include in the response, I get fewer and fewer results. So if I use only the date as a dimension, I get a large result and the more dimensions I add, it reduces eventually to 0 results. I imagine it is hiding the results that don't have a certain dimension available but I'd like to have them return null instead of hiding them. I'm specifically interested in this dimension call:
ga:dateHourMinute
ga:deviceCategory
ga:City
ga:pageTitle
then I get results, but then, when I add ga:userGender
or ga:userAgeBracket
I get 0 results back. Ideally the results would come back with null if they don't have that data, and with those fields if the data does exist. Can someone explain this behavior?
If you're seeing no or little data when querying demographics dimensions it's because:
https://support.google.com/analytics/answer/2799357?hl=en#thresholds
Thresholds are applied to prevent anyone viewing a report from inferring the demographics or interests of individual users. When a report contains Age, Gender, or Interest Category (as a primary or secondary dimension, or as part of an applied segment), a threshold may be applied and some data may be withheld from the report
OR
https://support.google.com/analytics/answer/2799357?hl=en#where
Demographics and interests data may only be available for a subset of your users, and may not represent the overall composition of your traffic: Analytics cannot collect the demographics and interests information if the DoubleClick cookie or the Device Advertising ID is not present, or if no activity profile is included.
In order to save computing/network resources, Google Analytics won't return certain data entries if:
OR
includeEmptyRows
flag to FALSE
in the API (can't change that behaviour for the UI).