Source Allies Logo

Sharing Our Passion for Technology

& Continuous Learning

<   Back to Blog

Google Analytics Data Export API

When Google exposed its Data Export API, it endeared itself closer to developers and to customers of Google Analytics. Data Export API allows us to develop client applications to retrieve data from existing analytics profiles of authorized users.

How does it work?

The Data Export API provides read-only access to all available analytics data. Any data that is displayed in the analytics web interface can be accessed through this API. Nice isn't it? You can get all your analytics data, for all your monitored websites and use it as you please.

Getting started

To get started basically you need very little -- a valid Google Analytics account and a client that would do all the low level work(sending HTTP requests with corresponding headers) or you could write your own small client that fits your needs. For example you could write shell scripts that use cURL under the hood. Anyway, it doesn't matter, the important thing here is to find a good way to communicate with the Google Analytics servers.

At this point, Google offers 2 solutions: a Java and a JavaScript client. Both are easy to use, but may not fit your needs. That's why there are also other similar clients in different languages like PHP, Perl, and Ruby.

The entire process of getting Google Analytics data and doing something useful with it can be split into 3 steps:

  • Authorization
  • Data feed
  • Parse XML feed and perform your computations.

In Part 2 I'll describe several ways of authorizations and when you would use each. But before that I'd like to mention some limitations. Basically Google has several quota policies, which currently are:

  • 10,000 requests per 24 hours (this limit applies to a single web resource)
  • 10 requests in any given 1-second period (this limit applies across all queries an application makes to the API)
  • 4 pending requests at any given time. Be advised that this limit is new and is subject to change
  • A query is also limited to pagination limits of 10,000 entries per feed, with a default response of 1,000 entries