3

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

Kyle
  • 181
  • 1
  • 5

4 Answers4

3

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:

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.

doug
  • 245
  • 2
  • 10
2

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

Mark Henderson
  • 68,316
  • 31
  • 175
  • 255
  • Hmm, i think i might need raw logs, it looks like there is a query limit on the api. – Kyle Mar 11 '10 at 03: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 03:49
0

Alternatively you can use Matomo which allows you have access to raw logs.

0

Simple answer: NO.

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

TomTom
  • 50,857
  • 7
  • 52
  • 134