Ildar Akhmetov
Ildar Akhmetov

Reputation: 1431

Google Analytics: different results with and without a dimension specified

I'm facing a pretty weird behavior of Google Analytics API.

Below are the examples of the queries I'm making using the Query Explorer. Dates and all other options are absolutely identical in both queries.

First query

metrics=ga:pageviews
filters=gaPagePath==/my_article_uri/

Result: 975

Second query

metrics=ga:pageviews
dimensions=ga:country
filters=gaPagePath==/my_article_uri/

Result: Azerbaijan: 3, Netherlands: 60, Russia: 2067, Singapore: 22, United States: 157

Total: 2309!

Question: Why the results are not equal?

I tried to google this, and it seems that the problem is the scope of the metrics/dimensions, but still can't really understand.

EDIT

For the first query, the results are NOT sampled.

However, for the second query (with the dimension specified) there IS sampling:

"containsSampledData": true,
"sampleSize": "499365",
"sampleSpace": "1568579"

Might be the reason?

Upvotes: 0

Views: 248

Answers (1)

XTOTHEL
XTOTHEL

Reputation: 5208

Based on the sampling reported back in the query, I believe the inaccuracies are due to sampling. The second query is based on about 32% of sessions.

If you decrease your date range so that both are not sampled, then they should match.

Upvotes: 1

Related Questions