Google Analytics and Google Earth
Posted in
Afternoon watch, 7 bells (3:44 pm)

I mentioned before that I have a Google Analytics account. One of my cow orkers asked if they had a way to export information into Google Maps or Google Earth, and I said I don't think so, it's still in beta. But they do have a way to export information, so I hacked together a quick program to translate Google Analytics geo information to Google Earth's KML format.

In Google Analytics, open Marketing Optimization, then Visitor Segment Performance. Click on Geo Map Overlay and you get their best world-map overlay. If you look at the upper right of the data window, you see an Export section, and the first icon is a T. Click it and save the data somewhere. That's what I use to get the information for my site.

Compile analytics2kml.cpp (or Seiz's modified version), or download my statically linked Linux binary here. See a copy of a converted file here.

Feel free to use my online version of the converter here.

See a screenshot of some results from this site here.

Like this utility? Browse my blog for more interesting things.

2006 November 27 Update:


Seiz's Version

Stefan Seiz sent a modified version of this short program back to produce slightly different visual results. Now you have two choices! Get his source code here.

I've updated the online utility to give everyone a choice for which version they'd like to use, regular or plus-Seiz. Heh heh. Man I crack myself up sometimes.

Update 2007 May 14
Apparently Google has taken it upon themselves to make a new interface, and I'll be working out how to use the new interface with the analytics2kml converter soon. In the meantime, switch to the older interface (right after you log in) and use the old export function.

July 26 2007 Update
Well, Google has officially stopped providing the data this entire project was based on. Until they allow exporting of GEO data again, or provide their own KML output, we'll just have to live with their decision. In the meantime, please write to Google and suggest KML output or to re-allow exporting of GEO data. Thanks for your support!

62 Comments »

62 Responses to “Google Analytics and Google Earth”

  1. [...] I wrote a program to convert Google Analytics data over to Google Earth's KML format, you can even convert online. Head over to my Convert Google Analytics to Google Earth KML page and give it a try!   [...]

  2. Adam S. says:

    Works great! Lots of fun to use and a handy way to visualize a long list of numbers.

  3. Hey, thanks for the tip over at the g-WH!Z blog. Appreciate that. I'll be using your converter here in just bit to try it out. Thanks for thinking of doing this!

  4. Stefan says:

    Works like a dream and a great idea. Thanks.

  5. jcburns says:

    Well done! And yeah, Google Analytics should have a 'kml' button that makes all your hard work unnecessary.

  6. Matt says:

    Great script! Works like a charm.
    Thanks!

  7. Gareth says:

    Excellent. What a great idea. I'm sure Google Analystics will push to include this in a future version. Works great. FWIW, I've posted my KML file on my Another Chance To See website for people to see.

  8. [...] I have to admit, this really opens your eyes when you see how global everything is these day. If you have a Google Analytics account, visit Scurvy Jake’s Pirate Blog and run the code. [...]

  9. B-Star says:

    That is so cool! Nice work! Thankx for sharing!

  10. Webmaster says:

    Heard about this on Ogle Earth blog and had to wait until my Google Analytics account got activated to try it out. It was worth the wait. Thanks for your hard work.

  11. Simão says:

    Just excellent!
    Thanks again and again.
    It is nice to see where visitors are coming from!
    "It's a small world after all!" 😉
    Say something when u come in Paris!

  12. Ian Davies says:

    Wow! That's fantastic - thanks so much for creating this program!

  13. [...] Google Analytics Viewers via Google Earth a converter to take the data collected by Google Analytics for where users are visiting your site and display the data as placemarks in Google Earth (tags: Google_Earth) [...]

  14. Reggie says:

    Thanks for all of your work. It's a great tool to have.

  15. Bull_UK says:

    Great tool, the kml produced even opens in NASA World Wind, my personal preference as I'm an OS dev on the project.

  16. Webmonster says:

    Thanks, I'm glad it works elsewhere as well.

  17. Amar says:

    Fantastic. Greta work!

  18. greips says:

    great work! 🙂

  19. Thank you so much for this I found this method very effective to show people and have an impact. When I cross reference something such as a content page from top content to cities to see all the cities who have viewed the content that exported data doesn't work unfortunatly. Is there anyway possible I could display those cities on the globe? Go ahead and email me if you want.

  20. R Pool says:

    I think this is great way to get into using Google Earth; I wouldn't have known where to start without your help. My next problem is trying to figure out how to customize the display of the globe to my specific needs. FOr example, I want to be able to change the color of all the placemarkers, or perhaps all of those on one continent. It seems I should be able to select them where they are listed, perhaps make a folder or something, and change them all at once--and also be able to generate a list of those changed. I'd also like to be able to create a flat map as well.

    Thanks for your help!

  21. Lieven says:

    Nice.., the day GA becomes a tool that can handle in real time stats, then this could be a very nice marketing tool:)
    A Question though, is it possible to add search phrases after the visits part?
    f.e. New York city (44 visits, "twin towers_5,liberty island_15") etc..)
    That would be cool 🙂

  22. Lieven says:

    ALWAYS A RECENT/UPDATED KML on my own site ONLINE :

    I linked Reget DL manager (https /user/pass) ...every stat has exact url with paramaters ,auto schedule +batch to transform all stats into unique reports + converts to kml files + soon gonna edit some xml to show everything in a nice way ( UL also scheduled)
    ->every day at 22 o clock for 5 secs
    ->in 5secs everything is done
    ->DL/convert/UL - always updated KML online
    ->soon other stats

  23. Maarten says:

    Best addition to google analytics I've seen so far. The normal Geo map overlay is useless since it doesn't provide for zooming. This tool is great. Strange that the creative people at Google did not already develop this.
    Thanks.

  24. Perfect, now I can see where my visitors are from. Way better than the normal map.

  25. Gaston says:

    Great job,

    This code makes worth to see where my viewers come from.
    I don't understand, why Google didn't come up with it..
    Maybee they have a job for u 😉

    I have to say, it didn't work directly from the linux downloaded program, but via you web php it works great!

  26. Webmonster says:

    The binary may not work on some systems because of library differences. Sorry if it doesn't work for any of you. The .cpp file should compile just fine, though.

  27. Matt says:

    This works great...really allows the data to spread out and gives a better view of how many different places are accessing my site. Great work!

  28. AlasdairGF says:

    I was so disappointed with the Analytics mapping... this utility helps an awful lot. Favourite thing: So easy! Really a couple of basic steps. Least favourite thing: Not really helpful for smaller-scale local mapping - though that's probably the fault of the data provided by Analytics rather than the conversion. Thanks, Scurvy Jake!

  29. JW says:

    Awesome! Once again, I'm proven that I'm not the smartest guy in the world.

    One thing...from a marketing perspective, if the 'Places' bar could show countries and expand to cities, it would help more to show to which languages a website should be translated than simply the 'cities' view does.

  30. Pat O'Malley says:

    Great job! I was looking for something to give me a better view of my visitors geographically since Google Analytics gives too high level a view. Thanks for the script!

  31. Theodore says:

    Hi All Experts,
    Does anyone use google earth images as ground image planes for use in aerial scenes. I know how to stitch them together but are there any tools or tricks to make sure that the images are at the same height, angle and such to make sure they stitch well. I know in the pro version you can get bigger images but im not going to pay for the pro version when i could stitch multiple images together...

  32. somnath ray says:

    Hi,

    this is excellent... i was so amazed that google didnt incorporate this into analytics in the first place.

    i have a question though.. the locations that it shows are the server locations.. is it not possible to pinpoint the exact ISp on the map?

    Best.. and an excellent job done.. congratulations
    Somnath ray

  33. Webmonster says:

    Apparently Google Analytics only gets a general area for the IP address it records, probably because that's all the more specific the information is. This may improve in the future, but for now we must be content with what we have.

  34. Faaborg says:

    Interactive 3D accelerated ego tripping 🙂

  35. Ramon says:

    Scurvy Jake, thanks a lot, man! The data looks great in Mac OS X's version of Google Earth.

  36. Webmonster says:

    Thanks, I appreciate you stopping by. Glad to hear it works in Mac, too.

  37. Bill says:

    Thanks! Nice tool. Is there some way to associate the ISP with the server?

  38. Webmonster says:

    Not that I've seen, Bill. The data that comes from Google Analytics doesn't contain much more than the Lat/Lon coordinates and the area name.

  39. Canuck says:

    Very cool. Worked like a charm!

  40. Chris says:

    Nice work! Looks great in GE 4. Thanks for the tool. 🙂

  41. David says:

    Very nice. Finally a way to see all your traffic not just chunks of 500.

  42. Very interesting. This would be cool to integrate in Analytics.

  43. Shea says:

    Great tool, thanks for the time saver!

  44. Peter says:

    Well what can I say - wow! This has just made a research project I'm doing at work much more interesting and intuitive.

    I'm looking into international development for an Arts festival and I'm hoping to be able to show where people actually came from along with where they looked at the web site from. This just cut out 90% of the work and the result is 90% better!

    On another note, I'd love to be able to see the Google Analytics data across time using Google Earth's 'time shift' feature. Of course this would involve stitching together several exports from Analytics.

    Congratulations and thank you for a very useful tool!

  45. Webmonster says:

    Thanks, I'm glad everyone likes it so much!

    Since release, I've been published in a Japanese book on Google Earth, had new versions submitted to me, and tons of great comments. I hope this helps Google realize that the short development time it takes to tie Google Analytics to Google Earth is worth its weight in gold.

    Do you hear me Google?

  46. [...] Cord wrote a very nice little converter which takes a tab-text file, exported out of your Google Analytics Geo Map Report and converts it [...]

Leave a Reply