UPDATED 07/31/09: Not sure if the problem was upgrading to firefox 3.5 or if the GDocs API folks changed how they handle uploads, but the script started returning 415 errors from GDocs. I worked with Google and now we have the problem fixed. Should work for all again.
Any suggestions? Please add them in the comments.
UPDATED 05/04/09: All fixed now. However, I am starting to notice some odd 404 errors coming from the Google Docs API. The file uploads nonetheless, but every once in a while the confirmation message comes back as a 404. Any suggestions? Please add them in the comments.
UPDATED 04/30/09: Google just made another change to their code which broke the script. I will work on fixing it starting next week. When it is fixed, I'll make another post. Thanks for your patience.
UPDATED: I
updated the script with many improvements to reliability and functionality.
UPDATED: I
updated the script to handle security changes made by Google to Google Analytics
Recently I was inspired to start
tinkering with Google Analytics using Greasemonkey after listening to a presentation by
Avinash Kaushik.
One problem that we have at work is that our version of Excel for some reason does not like the CSV files that GA exports. Our copies of Excel XP (I know its 6+ years old, but we just moved to it last year) only see the graphing data, but they do not recognize the tabular data further down in the CSV files.
After seeing the Juice Analytics integration for seeing new reports in GA, I realized that I probably could solve my export problem too using Greasemonkey. I decided to integrate GA with Google Docs, so I can do a one-click export to create a Google spreadsheet for analyzing the GA data.
Now, on any report that offers a CSV download, the user sees a new option for Google Docs:
Clicking the link will log the user into the Google Docs service and upload the report. Currently I have the # of records limited to 10000 rows of data, but I may make that a configurable option. After the report is successfully uploaded, the user received a confirmation message with a choice to open up Google Docs in a new tab or just to remain in GA:
Greasemonkey handles your data securely and only limits access to values stored by the user script to the user script itself. There is an additional measure of security I added that fully encrypts user passwords. Finally, the export service can only upload to Google Docs using the exact same account that you are currently using in GA. If you want to share, I suggest you share the spreadsheet after it has been created.
Installation Instructions
- You need Greasemonkey & Firefox 2+ installed
- If you have Greasemonkey working you will see a little monkey icon in your status bar:
- Now, download and install the user script (click OK/Accept on any message boxes. The file used to be called exporttogoogledocs.user.js, but apparently Userscipts.org renamed the file!)
- After opening choosing to open up Google Docs, the pop-up blocker may stop the new tab from launching...if so, you will need to allow pop-ups from the domain www.google.com because of the way Google handles the redirect.
Happy Analysis!