I am migrating Google Analytics API from V3 to V4. I seem to have come across a strange problem.
When I query for number of users ga:users with the segment gaid::-1 which stands for All Visitors, in V3 I get some number of users x and when I query the same parameters in V4, I am not getting the same number x. In fact the new number lets call it y is much greater than x. Almost twice of x.
Other metrics are all fine. Only ga:users is coming out to be a wrong value. Also, if I use some other segment like gaid::-2 then it comes out to be the same value as in V3. The problem is with gaid::-1 only.
Does anyone have an idea of what might be wrong?
Related
I am targeted to research whether this is doable:
To create a calculated metric (Order Submit) in google analytics (https://analytics.google.com/). I am using UA (not GA4). So I am going to create it in a view.
Order Submit:
Before 2021/12/18: [ga:eventAction] like '%Submit Button Click%'. value should be sum of [ga:uniqueEvents];
After 2021/12/18: [ga:eventAction] like ‘%checkout%’ and [ga:eventLabel] like ‘%2%’,value should be sum of [ga:totalEvents];
The ultimate goal is going to use the field via Google analytics API v4 in python. I know how to get the calculated metric via API once it's defined. But I couldn't figure out how to do the case statement for the calculated metric. It looks it can only handle simple operation on existing metrics, e.g. metric 1/ metric 2.
If that's not possible, any workaround?
BTW, I know in google data studio I can possibly create something like that using case statement, but it can not be used in google API v4 I suppose?
This is not possible with calculated metric. The walkabout is to get all related dimensions and metrics in a table. Then you can calculate by yourself using SQL or whatever language depending on where you stored the data.
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.
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
If I make a request to the Google Analytics API using only the metric "ga:users", the result is different to the one that is returned in the "totalsForAllResult" field when I add a dimension.
Does anyone know the explanation for this and which is the correct result?
You cannot sum up the user counts per dimension and get a gross total as one and the same user can appear in multiple dimension values. For a detailed explanation look here. If you want to get the total users value, repeat the API request w/o the dimension. Apparently, Google does the mistake of blindly summing the values themselves in the totalsForAllResults field of the response of the Core Reporting API which can be highly misleading.
For my recent project, i m trying to develop a brand new report for google analytics using the Sessions data over a period of time.
When I compare the numbers that I get from https://ga-dev-tools.appspot.com/query-explorer/ and check the report that we have created in analytics.google.com the numbers for sessions are off. They dont match exactly. They are off by like 1%. What might be the reason for this.
Can someone please help me here?
I can give more details if needed.
Thanks
Adding to the above , one more thing I noticed
This happens only When I add Segment filter to be specific. Without the segments the numbers for all users look good.
Had a call with Google Analytics support. They say that there isnt actual support for the Rest Api code and the Front End report from Google Analytics has built in Logic to filter out certain personal information like age related, sex, etc. which is not there in the Rest Api when it pulls in data.
So this is the reason why the numbers are off by 1% all the time.
Hope this helps
Thanks