Reputation: 31
I tried to perform two requests to Reporting API:
The metric results do not match. Why?
Example on https://ga-dev-tools.appspot.com/query-explorer/
Result for request one:
ga:yearMonth ga:users 201601 1372 201602 1701 201603 1980 201604 1779 201605 1465 201606 1336 201607 1402 201608 1595
Result for request two:
ga:year ga:yearMonth ga:users 2016 201601 1372 2016 201602 1525 2016 201603 1761 2016 201604 1531 2016 201605 1239 2016 201606 1084 2016 201607 1157 2016 201608 1365
Upvotes: 3
Views: 1587
Reputation: 2563
This answer maybe useful to someone having the same problem.Whenever there is mismatch in data between api and data on dashboard do following things.
Make sure you are using right parameters for both of them (similar metrics and dimensions).
If after step one still there is mismatch then its probably because sampling has been kicked in internally by the google , this is because even the smallest query requires heavy computation. To make sure sampling is being done there will be a field samplingSpaceSizes
in the response .
To avoid sampling make sure you loop over dates and query for each day independently.
in your case its most probably the issue of sampling because of huge date range (and this is because you GA account has lots of data), so intead of querying for a bigger range , loop over date range.
Also remember it may tae upto 48 hours for the fresh data to be processed.To make sure if your data is processed one look for a field isDataGolden
in response if its present that data is processed and so results will match. if that param is absent it means some of your data has not been processed yet.
Upvotes: 2
Reputation: 1788
Have you checked for sampling? The date range you're working with is on the large side, so you might consider testing with a smaller range to see if the totals become more consistent.
Another thing to consider is that Users metric can be pre-calculated or calculated on the fly. More information on the Users metric here
Upvotes: 0