views:

818

answers:

7

So Google Analytics does not have an API that we can use to get our data, so is there an efficient way to programaticly fetch the data collected by Google, without logging it locally?

Edit: I would prefer a Python or PHP solution but anything will work.

+1  A: 

Well, it depends on what you want to do with the data. If you only want to process part of it, then I don't think it is difficult.

Here's a basic web search with a hit explanations from Google and someone else: http://www.google.com/support/analytics/bin/answer.py?hl=en&answer=55561 http://blogoscoped.com/archive/2008-01-17-n73.html

Slavo
First link I have seen, and none of the options given by google are programmatic, unless I'm going to write a reminder program :( The second I have seen but I was hoping for less of a hack. +1 for the effort.
Unkwntech
A: 

Its been a while since I had to deal with this, but Google Analytics has an XML output type, so you can parse that to get the data in your own system. However, I believe that there is no way to get the xml file programatically, so someone still has to go in and generate the file and feed it to your app.

Good question though, I'd love to see if there is a 100% automated solution.

Giovanni Galbo
This is what I'm hoping for, I want to be able to send customized reports to my clients each month so they know whats going on without me having to remember to do it.
Unkwntech
+4  A: 

Also, I forgot about this: I never actually completely implemented this for a client because the deal fell through...

But you can customize the dashboard to include the sections of Google Analytics that your report might need and have a scheduled email. If the reports do not need to be too detailed and if Google already aggregates the data in the way you need it, then this might work for you.

Giovanni Galbo
+1  A: 

There is a completely programmatic way to access the data using greqo(PHP), but the analytics class is in beta. Check it out here.

If beta is not acceptable, you can use a mixture of the XML and Yahoo Pipes to get what you need.

Basic Method

Obtain the tracking data in a usable format – We can schedule Google Analytics to email this as an XML file on a regular basis.

Make the XML file accessible online – By emailing an attachment to Google Groups, the file is automatically given a public URL.

Work out the URL of the most recent report – Since Google Groups provides RSS/Atom feeds for all messages, we can easily find the URL of the most recent message and therefore work out the URL of the XML report.

Prepare the data for use – We need to manipulate the XML and massage it into a handy JSON format that we can use on our blog, which can all be done using Yahoo Pipes.

Taken from here.

jeremy
+1  A: 

I implemented a solution where we scheduled the analytics report to be emailed to a gmail account each day and I pulled the report on demand via POP3. It's pretty easy and works fast. I've heard Epic1 will do this for you as well. I'm researching that now.

+8  A: 

Google just announced that they're making available a data export API for Google Analytics. It sounds like that's exactly what you're looking for.

Per their announcement, the feature's currently in private beta, but I figure it'll be rolled out to all accounts in coming weeks/months. Depending on your needs, you may just want to wait, instead of building a short-term hackish solution.

If you're interested, I presume that the functionality's being rolled out first to members of the Google Analytics Trusted Tester program.

Anirvan
At Google, they use beta and beta. Gmail is in beta too, but also my main e-mailprovider for the last 4 years....
Gerrit
+1  A: 

The Google Analytics API is now open to everyone and looks like it contains the full data set

Yes, indeed it is.
Unkwntech