Google Analytics Visualization
Sometime ago I discovered the project called Gource, which is a Software Version Control Visualization tool created by Andrew Caudwell. Gource has a very interesting visualization structure which isn’t exclusive to Version Control systems, but also for a large variety of data; actually, you can create your own custom log (see CustomLogFormat wiki for more details) in order to use Gource visualization for your own data.
So I have created a Python script which exports the data from your Google Analytics profile and then convert it to the custom Gource log format. To extract Google Analytics data I used the Google Data API bindings for Python, you also can make your own Google Data API query (see some samples here).
My query to Google Data was:
'ids': 'ga:[profile id]', 'start-date': '2011-01-19', 'end-date': '2011-02-02', 'dimensions': 'ga:pagePath,ga:date,ga:hour,ga:country', 'metrics': 'ga:visits', 'sort': 'ga:date,ga:hour', 'filters': 'ga:pagePath!@outbound;ga:pagePath!@translate;ga:pagePath!@search', 'max-results': '500'
See that I used some filters to avoid outbound links, Google Translate links from users as well the Search option. The profile I’ve used in this example is the Pyevolve Documentation site which has two main directories (a site with more directories should provide you better visualization, since Gource is specially good on viewing branches on Version Control Systems), I also have limited the size of the results to 500, so we can get a short video.
Instead of using unique users to represent users, I’ve used countries and I also changed the default user icon from Gource to world flags (by Vathanx, you can download them here).
And here is the result (see in HD – 720p):
You can download the source code here. See the comments inside the script to use with your Google Analytics Profile. In order to get flags working, you need to extract the flags to a directory and then run “gource custom_log.txt –user-image-dir [directory-with-the-pngs]“.
I hope you enjoy it =)
– Christian S. Perone
Do you think it could be used to visualize an evolutionary algorithm as well? I am not sure what a user interaction might be, maybe the use of genetic operators?
I think it could be used, but it shouldn’t be so good as other visualizations, maybe adapting it (making a fork of the project) could be very nice. Thanks =)
Really nice “gource-extension”. However, I couldn’t make it work with version 0.31 only 0.26b. Also, when I feed the directory with the images, using 0.26b. , I get a “invalid dir option”.
Which gource version did you use?
Thanks, Filipe.
Hello Filipe, I probably used the version 0.29, which is the latest version in the day I created the post.
How did you executed gource ? You shouldn’t get this error if you’re using a valid directory for the images.
Got it working with 0.29.
The “invalid directory” is a weird, only happened with 0.26b.
Anyways, the log format must have changed from 0.29 to 0.30 (and 0.31). I’ll try to make the modifications to get it working with the latest version, but my python isn’t that good…
Thanks.
Thanks for this concept. Would you mind to give latest update version?