Tuesday, April 21, 2009

Attention Developers: Google Analytics now has an API!

Today we are pleased to announce the launch the Google Analytics Data Export API. This new API is being launched in Labs and is available to all Analytics users. If you haven't already heard, Google Analytics, is a free, powerful web analytics tool that provides a wealth of data about how visitors find your website, where they go and if they turn into customers.

So what's so exciting about this API?

The Analytics API will allow developers to extend Google Analytics in new and creative ways that benefit developers, organizations and end users. Large organizations and agencies now have a standardized platform for integrating Analytics data with other business data. Developers can integrate Google Analytics into their existing products and create standalone Google Analytics applications. Users could see snapshots of their Analytics data in developer created dashboards and gadgets. For example, how would you like to access Google Analytics from your phone? Now you can, with this Android application from Actual Metrics. How about accessing Analytics from your desktop? It's here from Desktop-Reporting.

So how does it work?

We made the API very easy to use. First, there are no complicated developer tokens, you only need to request an authentication token. Second the Analytics Export API is free and available for all Google Analytics users. The Analytics API is a GData API which is based on the Atom 1.0 and RSS 2.0 syndication formats. This is the same API protocol for Google Calendar, Finance and Webmaster Tools. If you've used any of these APIs in the past, the Analytics Export API will look very familiar to you.

Accessing your Google Analytics data generally follows these three steps:
  • Request an authentication token from your Google Account
  • Create a URL with the data you'd like to get back from the API
  • Make an HTTP request to the Export API using the authentication token and the URL you created
Currently the Google Analytics API supports two GData feeds: an Account Feed (which lists all the Google Analytics accounts and profiles you have access to) and a Data Feed (which allows access to all the data available through the GA interface). The Analytics data feed is very powerful and allows you to query which GA dimensions and metrics you want to access, for a specified date range and even across a subset of data.

So it's now simple to access data GA data to answer questions like:
  • What are the top referral sources by conversions to my site?
  • What are the top browser language settings in the United States vs. the United Kingdom?
  • What are the top keyword refinements and destination pages being used on my internal site search?
How do I get started?

There are three key resources you'll want to use when you start developing on top of the Google Analytics API. First we've provided two client libraries to abstract and simplify the process. The Java client library is available in the GData client library. And a JavaScript client library is now available through the Google AJAX APIs GData loader. We're also working on supporting more programming languages. In the meantime, for any programming language you want to use, you can make requests directly to the API over HTTP and access the data in XML. You can find example code, a developer guide, FAQ, and the complete API reference at Google Code.

Second, be sure to sign up for the Google Analytics API Notify email group so you get the key announcements on feature updates, code changes and other service related news that relate to the API. (Don't worry, this will be a low-traffic email list and we promise to only send emails when there is something important that affects developers.)

Finally, you'll want to become a part of the Google Analytics Developer community by joining the Google Analytics APIs Group for developers. This user forum is a great way to share ideas and get feedback from other developers. We also check in on these forums so let us know what you think about the API there, and share your ideas and your applications with us. We look forward to seeing your creativity!


  1. very nice man
    do u have any code example?

  2. Stratigent is holding a contest for the best applications that use the Google
    Analytics API.

    Submit your App here:

    Winners will get a free pass to the Google Analytics User Conference in Chicago
    on Nov 4 and the opportunity to present the App live on stage (but only if you
    want to).

    Baha Khodjaev,