Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Can I download the raw logs of my Google Analytics data? I want to do some processing on the data.

share|improve this question

3 Answers 3

I don't think you can get the raw logs, but you can certainly access the data via an API, outside of your web browser:

http://code.google.com/apis/analytics/docs/gdata/gdataDeveloperGuide.html

share|improve this answer
    
Hmm, i think i might need raw logs, it looks like there is a query limit on the api. –  Kyle Mar 11 '10 at 3:41
    
If you're receiving < 10,000 datapoints per day, I guess you could run a batch every hour or so to collect the latest data and write it into your own raw data file. I had an issue where I needed to do about 100,000 geocode requests via the Google API to fill a backlog in our database. I just set it to run 10,000 at a time and started it each time before I left work. 10 days later, backlog complete. –  Mark Henderson Mar 11 '10 at 3:49

Well, you can't directly access GA's logs, but it's not difficult to regenerate a GA log (for your own GA account) with complete fidelity.

We know exactly what data are in these GA logs because Google has told us. Google has also explained how the data comprising the log is collected.

Here's the gist: All of the reports/data views in the GA web browser are created by parsing a transaction log which in turn is created one line at a time. The GA server collects every one of those lines in exactly the same way--by receipt of a long list of parameters appended to a client request for a single-pixel GIF. (This request is initiated by the ga.js which downloaded and executed by the client/browser.) That list of parameters is comprised of all GA data sources: the location bar ('http://wwww....'), the HTTP Request headers, data from the DOM, cookies set/updated on the client. The data from all of these sources are aggregated and packed into this parameter list and appended to the request for __utm.gif.

An example:

utma%3D97315849.1774621898.1207701397.1207701397.1207701397.1%3B">http://www.google-analytics.com/_utm.gif?utmwv=4&utmn=769876874&utmhn=example.com&utmcs=ISO-8859-1&utmsr=1280x1024&utmsc=32-bit&utmul=en-us&utmje=1&utmfl=9.0%20%20r115&utmcn=1&utmdt=GATC012%20setting%20variables&utmhid=2059107202&utmr=0&utmp=/auto/GATC012.html?utm_source=www.gatc012.org&utm_campaign=campaign+gatc012&utm_term=keywords+gatc012&utm_content=content+gatc012&utm_medium=medium+gatc012&utmac=UA-30138-1&utmcc=__utma%3D97315849.1774621898.1207701397.1207701397.1207701397.1%3B...

This is not difficult to parse--each parameter is a variable beginning with 'u', eg, 'utmn.' Each parameter in turn has a value. 'utmn' for instance is the GA Account ID; and 'utmcc' are the cookies. You can decode the various GIF Request paramaters by referring to the GIF Request Parameter lookup table provided by Google.

Sp to recreate GA's log for your GA account, you just need to capture each of these GIF Requests. It's not difficult to log all of this data to your Apache activity log:

First, add this line to the GA tracking code for each page on your Site:

page.Tracker.__setLocalRemoteServerMode();

This provokes a request for __utm.gif from your webserver as your page is loaded.

Then add this resource (__utm.gif) to your web server root so that you can serve it.

share|improve this answer

Simple answer: NO.

You can though get your server logs, you know ;)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.