Google Analytics Reporting API - ga:mobileDeviceInfo dimension - google-analytics

I am trying to obtain session data from the Google Analytics API (v3), however am getting some very strange results.
If I use the ga:sessions measure and ga:dateHourMinute dimension; I am able to obtain correct results.
However - if I add ga:mobileDeviceInfo as another dimension to the query, I receive a reduced dataset (based upon total of ga:sessions)
Is anyone able to assist?

It appears that non-mobile devices (rather than populating ga:mobileDeviceInfo as null) will be excluded from the results when including this dimension. This does not appear in the documentation.

Related

Google analytics API v4, userEngagementDuration metric shows wrong values with medium dimension usage

Using explore tab at analytics page I've noticed that "User Engagement" parameter completely different from my API response.
I've thought that the error is in my code, so I've tried to re-check the request using https://ga-dev-tools.web.app/ga4/query-explorer/ and "try this method" tab at https://developers.google.com/analytics/devguides/reporting/data .
They both gave me same number that was different from the explore tab.
This metric works fine with all other dimensions, the issue appears only when combining with medium dimension.
All the dates, conditions, queries, were re-checked multiple times, all other types of metrics work fine, every number matches with report in explore tab, except of this one userEngagementDuration.
Also, bug reproduces only at Analytics Reporting API in batchRunReports method, at Google Analytics Data API with method runReport the parameter SessionDuration is the same as in report at explore tab. So the issue is only at Analytics Reporting API and userEngagementDuration parameter. Also this issue is not connected with sampling level, because this option is absent at BatchRunReportRequest.

Getting dimension data from Google analytics even when the data for that dimension is not available

I am using the Google Analytics reporting tool in PHP.
I am having trouble when i am Querying the data when the Dimension data is not available.
For example :
These are the dimension
ga:date,ga:countryIsoCode,ga:eventCategory,ga:eventAction,ga:eventLabel which i have.
These are the metrics
ga:totalEvents which i have.
But the problem is that for some data ga:eventLabel is present and for some ga:eventLabel is not Present.
When i query using the dimension and metrics in the result set data does not include the data which does not have ga:eventLabel.
How can i get the data even when the ga:eventLabel is missing?
This is how GA reporting works.
Empty dimensions will almost always filter away the other dimensions. (few exceptions where GA uses (not set))
You either need to always add a value to the ga:eventLabel upstream while tracking or do the hard query work.
1. ga:eventCategory
2. ga:eventCategory,ga:eventAction
3. ga:eventCategory,ga:eventAction,ga:eventLabel
Then you - intelligently - stitch the dataset together.
You need to make sure you don't use result from 1 that is drill down in 2 etc.

DataStudio Google Analytics Connector Showing Zeros for Some Metrics

I have a google analytics report in datastudio. One of the pages in the report is attempting to report on events. In GA when looking at the event in the e-commerce explorer tab I will see data for revenue, ecommerce conversion rate, per session value, but in my data studio report all values show as zero.
This is a straight google analytics data source (i.e. there is no data blending).
Screen shots below of the datastudio result and the analytics report for the data I am trying to match.
Every resource I can find says this should be possible and the fact that Google Analytics has the exact same data showing again makes me think this is possible.
Is there an issue with what I am doing or the metrics / dimensions I am calling? If not why isn't this working?
I have struggled with something like this too. I would guess that the problem is with the decimal places, which I couldn't get to work in GDS - zeroes all over the place, just like you are getting. When I multiplied the defined event value by 100, it all worked. Worth a try, I think.

Core Reporting API v4 sampling limit for click data

After how many clicks will the Core Reporting API start to sample the click data, when using samplingLevel=LARGE?
I'm trying to retrieve data from a large account (i.e. more than 30,000 clicks/day on average) and the number of clicks doesn't always match what I can see on Google Analytics. This, however, seems to happen only on this large account, and not every day. Strangely, on those days where the click count doesn't match, transactions and revenue match what I can see in Google Analytics.
In my query, I'm only trying to retrieve the data for a given account, without applying any filter.
EDIT: If I don't retrieve data aggregated at the account level ― thus not including ga:adwordsCampaignID, ga:adwordsAdGroupID and ga:adwordsCriteriaID in the dimensions ― I can retrieve all the clicks.
EDIT2: If add the ga:deviceCategory dimension, along with ga:adwordsCampaignID, ga:adwordsAdGroupID and ga:adwordsCriteriaID I can retrieve all clicks. I'm not sure if this can help narrow down the issue.
Google Analytics has a cardinality of 50K after that you ll receive (others)
Based on the "EDIT" i can safely assume the reason is that when a click doesn't have an 'ga:adwordsCampaignID' associated with it, it ll not retrieve that click. This happened to me with custom dimensions.
EDIT: Try using the 'include-empty-rows' parameter on your query. https://developers.google.com/analytics/devguides/reporting/core/v3/reference#includeEmptyRows

Mixable metrics and dimensions in google analytics

I'm doing some complex reports for google analytics and would like to ask you if the following is possible. The client wants to have just organic data for a bunch of metrics. Like pageviews, visitBounceRoutes, etc. The query I ended up with is the following:
https://www.googleapis.com/analytics/v3/data/ga?dimensions=ga:source,ga:medium,ga:keyword,ga:day,ga:month,ga:year&end-date=2013-11-20&fields=columnHeaders/name,rows,totalResults,totalsForAllResults&filters=ga:medium==organic&ids=ga:79067749&metrics=ga:pageviews,ga:pageviewsPerVisit,ga:visitors,ga:avgTimeOnSite,ga:newVisits,ga:visitBounceRate&start-date=2013-10-20
However the response is as follows:
'{"totalResults":0,"columnHeaders":[{"name":"ga:source"},{"name":"ga:medium"},{"name":"ga:keyword"},{"name":"ga:day"},{"name":"ga:month"},{"name":"ga:year"},{"name":"ga:pageviews"},{"name":"ga:pageviewsPerVisit"},{"name":"ga:visitors"},{"name":"ga:avgTimeOnSite"},{"name":"ga:newVisits"},{"name":"ga:visitBounceRate"}],"totalsForAllResults":{"ga:pageviews":"0","ga:pageviewsPerVisit":"0.0","ga:visitors":"0","ga:avgTimeOnSite":"0.0","ga:newVisits":"0","ga:visitBounceRate":"0.0"}}'
Can the dimensions ga:source,ga:medium,ga:keyword be mixed with the above metrics? It seems they can't since if I omit them the API returns an array of values 1 per each day within the specified range.
Where can I find more information about this and what categories are mixable? https://developers.google.com/analytics/devguides/reporting/core/dimsmets just shows all the available metrics but do not explains how they are combined and which one would be valid requests. I'm new at the analytics API and would be great any kind of help or guidance
Thanks a lot
Google Analytics Query Explorer is your friend for playing around with analytics dimensions/metrics/filters ;-)
Try http://ga-dev-tools.appspot.com/explorer/?dimensions=ga:source,ga:medium,ga:keyword,ga:day,ga:month,ga:year&metrics=ga:pageviews,ga:pageviewsPerVisit,ga:visitors,ga:avgTimeOnSite,ga:newVisits,ga:visitBounceRate&filters=ga:medium%253D%253Dorganic&start-date=2013-10-20&end-date=2013-11-20&max-results=100
Some thoughts:
Those dimensions & metrics should work -- maybe there was no organic data recorded during that time range?
Try removing the ga:medium==organic filter and see what your data looks like.
Does the profile you're using (ga:79067749) have any filters on it? If so, maybe try a different profile that has unfiltered data. (Analytics best practices -- make sure you have a profile with no filters applied that captures all data.)
As Mike said, there is no problem with the combination of metrics and dimensions you are using.
If you are entering the URL query directly in the browser problem might be the lack of URL encoding in your query string. For example, you need to convert == to %253D%253D
For example, instead of ga:medium==organic, you need ga:medium%253D%253Dorganic
If you build your query in the Google Analytics Query Explorer as Mike suggests, you can grab the direct link to your report by clicking the link symbol in the upper left:

Resources