Google Analytics API on App Engine Treemap Visualization
Friday, October 30, 2009 | 1:25 PM
Labels: Analytics API
It's Friday, time for some fun! Advanced API analytics fun :)
Here is a captivating way to look at your Google Analytics data in a Treemap visualization. You can visualize your own data with our live demo. (Note: IE currently not supported for visualization part.)

click to enlarge
And, here is a video explaining how to look at the Treemap visualization and how to use it.
The goal of this example was to teach people how to use the Google Analytics API on App Engine in Java, as well as to demonstrate how to use both OAuth and AuthSub along with the App Engine's various services. The code looked great, but the output was a boring HTML table. So we used some open source tools to transform the table into a pretty tree map visualization, which is also useful in noticing interesting metrics.
All the code has been open sourced on Google Project hosting. Also, here's an article describing how this application works making it easy for developers to use this example as a starting point for new data visualizations and other Google Data projects.
For the data retrieval part, we used the App Engine Java SDK and the Google Analytics Data Export API Java Client Library to retrieve data from Google Analytics. The example code implements both unsigned AuthSub and registered OAuth authorization methods allowing developers to get up and running quickly in their dev environment and later switch to a secure authorization method in production environments. The application also uses the Model-View-Controller pattern, making it flexible and allowing developers to extend the code for new applications (e.g. adding support for other Google Data APIs).
And lastly, for the visualization part, we used the open-sourced Protovis SVG Visualization Library to create the Treemap. This JavaScript library is maintained by the Stanford Visualization Group and excels at creating brand new visualizations from a data set (in this case a boring HTML table). To handle all of the interactions, including rollover, tooltips and slider controls, we used JQuery. Here is the JavaScript source for the visualization part of the sample.
Enjoy!
p.s. If you have created any cool new visualizations using the Google Analytics Data Export API,email us so we can highlight them as well.


6 comments:
Boyprose said...
Not working. After completing the install steps including authorizing with Google Analytics, I get the screen that says 'Authorize with Google Analytics' again. Chrome developer channel / OS X 10.6.1.
2:15 PM
Directeur said...
I have a question. If i look in my analytics i see if i click on Windows:
1.XP 309 63,58%
2.Vista 102 20,99%
3.NT 36 7,41%
4.Server 2003 35 7,20%
5.2000 4 0,82%
But where is Windows 7? I have Windows 7 and he count my as something else..
5:42 AM
Jim Williams said...
The Treemap visualisation looks great - but I am having trouble setting it up to work with my Google Analytics Account. Keeps asking me to Grant access at Google Accounts and then sends me back to the Logout / Grant Access page again.
1:49 PM
Deborah e. Hecht, G.G. said...
I love the Treemap! Looking forward to using it.
Deborah
8:46 PM
Sebbi said...
Hmm, it doesn't do anything after I authorized it to use my Analytics data and shows me just the previous page with a logout and an authorize link.
What is supposed to happen then?
3:46 AM
Lewis H said...
Nick,
I'm writing a technology/culture article for H-Monthly about the next phase of the social web.
I'm focusing on Yelp, Google Analytics and Digg (possibly if I interview Jay). I interviewed Jeremy last week.
I'm under deadline, but I'd like to give someone at Google Analytics the chance to respond to some questions.
Please forward me email to the appropriate person and please let me know what this is. lewisha at g[you guessed it]mail
thanks
Lewis
1:56 AM
Post a Comment