[GA-API] Aggregating by Month

1,514 views
Skip to first unread message

mschenkel

unread,
Apr 21, 2010, 8:54:08 AM4/21/10
to google-analytics-api - GA Data Export API
Scenario: I would like to query monthly visits over the history of a
profile, then feed this to a line graph where the X-Axis is "Time". I
know of two ways to do this:

1) Query ga:date and ga:visits over the lifetime of the profile. I
then have to write code to aggregate for each month.

2) For each year in the past, query ga:month and ga:visits and then
combine them all together.

Option (1) is just pulling a lot of data which will ultimately be
aggregated. Option (2) requires the dimension ga:month to be
converted to a date value. This becomes even more difficult when
trying to do this by week.

Is there a way I could query ga:visits and ga:date between two dates
and specify "Sum by Month". The results would be the visits for each
month. And the value of the ga:date would be the first day of that
month.



--
You received this message because you are subscribed to the Google Groups "GA Data Export API" group.
To post to this group, send email to google-analytics...@googlegroups.com.
To unsubscribe from this group, send email to google-analytics-data-...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-analytics-data-export-api?hl=en.

mschenkel

unread,
Apr 21, 2010, 9:01:08 AM4/21/10
to google-analytics-api - GA Data Export API
Actually I just logged on to the Google Analytics interface.
Basically I am trying to mimic a situation where the dates span more
than one year and "Graph By" dimension is either "Week" or "Month".
In the ensuing chart GA renders it labels the time frames ("April 4,
2010 - April 10, 2010" or "March 1,2010 - March 31,2010").

chrissky

unread,
Apr 21, 2010, 10:03:27 AM4/21/10
to google-analytics-api - GA Data Export API
I think option 2 is your best bet in the case of monthly aggregation.
Creating date labels will not be too hard.

Weeks will be harder since GA returns partial weeks. It would be
easier if Google used ISO weeks so that weeks were always 7 days. I
think that has been submitted as a feature request.

Chris H.
ShufflePoint


On Apr 21, 9:01 am, mschenkel wrote:
> Actually I just logged on to the Google Analytics interface.
> Basically I am trying to mimic a situation where the dates span more
> than one year and "Graph By" dimension is either "Week" or "Month".
> In the ensuing chart GA renders it labels the time frames ("April 4,
> 2010 - April 10, 2010" or "March 1,2010 - March 31,2010").
>
> --
> You received this message because you are subscribed to the Google Groups "GA Data Export API" group.
> To post to this group, send email to [email address].
> To unsubscribe from this group, send email to [email address].

mschenkel

unread,
Apr 21, 2010, 11:15:38 AM4/21/10
to google-analytics-api - GA Data Export API
Thanks Chris - very well worded answer and I was kind of expecting
it. Indeed, when you start to deal with weeks it gets a bit more
complicated; especially when you don't really know what the actual
dates are that correspond to each week number.

Thank you for your reply.
Reply all
Reply to author
Forward
0 new messages