Zane Claes
Zane Claes

Reputation: 14954

Google Analytics API "ga:day" dimension and more than 1 month of data returns aggregate instead of absolute values

I am attempting to retrieve Google Analytics daily visitor counts. I'm following this blog post.

For under 30 days of consecutive data, everything works great. The problem is that the result rows get "grouped together." Consider this query:

    { ids: 'ga:44339606',
  'start-date': '2013-01-01',
  'end-date': '2013-02-14',
  dimensions: 'ga:day',
  metrics: 'ga:visits',
  segment: 'gaid::-1' }

The values returned for days 01 -14 are incorrect, because they actually represent the sum of January 1st + February 1st, and the sum of January 2nd and February 2nd, and so on. In other words: there is only one entry returned for each day of the month, 1-30, instead of returning 44 entries.

How can I adjust for this, without breaking the query into multiple calls?

Upvotes: 5

Views: 7324

Answers (1)

Zane Claes
Zane Claes

Reputation: 14954

Turns out, I wanted the ga:date dimension instead of ga:day Check out the playground; it's great for figuring out params: https://ga-dev-tools.appspot.com/explorer/

Upvotes: 14

Related Questions