Can I download the raw logs of my Google Analytics data? I want to do some processing on the data.
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.
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.
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:
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.
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: