views:

1057

answers:

4

Is it possible to obtain raw logs from Google Analytic? Is there any tool that can generate the raw logs from GA?

+5  A: 

No. But why don't you just use your webserver's logs? The value of GA is not in the data they collect, but the aggregation/analysis. That's why it's not called Google Raw Data.

MattW.
+2  A: 

No you can't get the raw logs, but there's nothing stopping you from getting the exact same data logged to your own web server logs. Have a look at the Urchin code and borrow that, changing the following two lines to point to your web server instead.

var _ugifpath2="http://www.google-analytics.com/__utm.gif";
if (_udl.protocol=="https:") _ugifpath2="https://ssl.google-analytics.com/__utm.gif";

You'll want to create a __utm.gif file so that they don't show up in the logs as 404s.

Obviously you'll need to parse the variables out of the hits into your web server logs. The log line in Apache looks something like this. You'll have lots of "fun" parsing out all the various stuff you want from that, but everything Google Analytics gets from the basic JavaScript tagging comes in like this.

127.0.0.1 - - [02/Oct/2008:10:17:18 +1000] "GET /__utm.gif?utmwv=1.3&utmn=172543292&utmcs=ISO-8859-1&utmsr=1280x1024&utmsc=32-bit&utmul=en-us&utmje=1&utmfl=9.0%20%20r124&utmdt=My%20Web%20Page&utmhn=www.mydomain.com&utmhid=979599568&utmr=-&utmp=/urlgoeshere/&utmac=UA-1715941-2&utmcc=__utma%3D113887236.511203954.1220404968.1222846275.1222906638.33%3B%2B__utmz%3D113887236.1222393496.27.2.utmccn%3D(organic)%7Cutmcsr%3Dgoogle%7Cutmctr%3Dsapphire%2Btechnologies%2Bsite%253Arumble.net%7Cutmcmd%3Dorganic%3B%2B HTTP/1.0" 200 35 "http://www.mydomain.com/urlgoeshere/" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.19 (KHTML, like Gecko) Chrome/0.2.153.1 Safari/525.19"
Shermozle
Have you actually implemented this successfully? It sounds like a great solution!
Liam
Yes. I've just added an example.
Shermozle
+1  A: 

You can get the Analytics data, but it'll take a bit of hacking.

In any analytics report, click the 'email' button at the top of the screen. Set up the email to go to your address (or a new address on your server) and change the format to csv or xml.

Then, you can use php (or another language) to check the email account, parse the email and import the attachment to your system.

There's an article entitled 'Incoming mail and PHP' on evolt.org: http://evolt.org/incoming_mail_and_php

adam
That's not the raw data he's after.
Shermozle
+1  A: 

Please have a look on this article which explains a hack to get Google analytics data. http://blogoscoped.com/archive/2008-01-17-n73.html

Also If you can wait for sometime then official Google analytics blog says that they are working on data export api but currently it is in Private Beta. http://analytics.blogspot.com/2008/10/more-enterprise-class-features-added-to.html

Mahin