2

When using the API, results for the metric "ga:uniqueEvents" are consistently lower then shown in the webinterface. The results for "ga:totalEvents" are the same as in the webinterface. Is there a extra filter in the API or what else can cause this ?

Example request: https://www.googleapis.com/analytics/v3/data/ga?ids=ga:....&start-date=2016-10-01&end-date=2016-10-01&metrics=ga:totalEvents, ga:uniqueEvents&dimensions=ga:eventCategory, ga:eventLabel&sort=ga:eventLabel&filters=ga:eventCategory==%category name%

2
  • Wild guess: I think the category name in filters in the API might be case sensitive. so if you have Button, button, and BuTTON. only the one you request comes back. Or is it the other way around Website isn't case sensitive and the API is. Commented Nov 2, 2016 at 11:26
  • I am tracking the events from one place so the naming of the category is consistent, thanks anyway Commented Nov 2, 2016 at 14:50

1 Answer 1

2

result mismatch occurs when either you are using a very big date range or many dimensions in single requests because of which sampling kicks in.

as i can see you are requesting for a single day,the probability that sampling is being done is very low( it is possible if you have lots of data in that account) , The other reason is you could be requesting immediate data, you should take into consideration that it takes about 48 hours for the data to get processed .

To conform if the data you are getting from the api is processed check for a parameter something like isGoldenData in the response. if its not-there it conforms that the data is yet unprocessed.

Sign up to request clarification or add additional context in comments.

4 Comments

How many dimensions are "many dimensions"? My date range is 30 days and I query 8 dimensions.
@JimmyAdaro as far as i understand usually querying up to 4 or 5 dimensions at a time might give miss matches but it can be as small as 3 dimensions depending upon the data that you might have for a particular account.also, i don't know if it's documented anywhere the number of dimensions that should be used at once.As a general rule, you can split up a single big query into multiple smaller queries and combine the results at your end
@JimmyAdaro but 8 dimensions is definitely large enough to kick off sampling & hence miss matches
I just set $request->setSamplingLevel("LARGE"); and now the API data is more like the Analytics page data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.