A while back I created a map mashup & backend to track visitors to my blog (all 3 of you) (Tracking my visitors ... with Maps, Nov 14, 2005). It just so happened it was the same day that Google put out their Analytics (nee urchin) product publicly. I’ve been quite happy using Analytics, since Google’s ability to track and resolve city locations is much better than mine, but the Analytics maps aren’t easily shareable.

Ian pointed me to this blog post and I just had to reproduce. Here’s a java jar that you can run at the command line to convert Google Analytics data to KML for use in Google Earth.

USAGE: java -jar UrchindataToKml input_report.xml [output.kml]

I used a different export method, their XML export method:

Logging into Google Analytics, go to All Reports and expand Marketing Optimization. From there, expand Visitor Segment Performance and then click on "Geo Map Overlay."

Then, select the little document-looking icon from the upper right hand corner. An xml document should open up. Save that somewhere on your filesystem.


Here’s the XSLT for urchindata xml to KML: UrchindataToKml.xsl ... and here're my latest results:

Some further thoughts:

Manually exporting and running a command-line program is, well, manual and annoying.

In order to automate retrieving urchindata map xml and converting it to KML, it’d need: a way of logging in a way of choosing a date range (would be nice) an api!
I’m sure Google’ll get around to making some sort of API for it. Knowing Google, I’m sure there’s already some unpublished API that just has to be ferreted out.