Google Analytics API Released - Now Get Your Web Site Metrics via Code

Google Analytics, the feature-rich website analytics tool, has been available for free to web developers since 2006. However, access to the service has been completely browser-based, limiting the ability for developers to create new reporting tools, widgets, or clients for mobile devices. After a long wait, the popular service has finally opened up now that Google has announced the availability of the Analytics Data Export API (our Google Analytics API profile).

As the Data Export API website describes:

Use the Google Analytics Data Export API to download Analytics data in the form of Google Data API feeds. With the Data Export API, you can embed a customized dashboard in your website to display the most commonly viewed or requested page statistics for all your reports users. Or, you can integrate your Google Analytics Data with other website data that you might be tracking in a separate system.

Like many other Google APIs, the Analytics Data Export API does not require developers to sign up for a separate key. The API provides per-session token based authorization using OAuth, Google's AuthSub proxy, or a ClientLogin username-password combination through a POST request. Data is returned in standard XML syndication formats, allowing developers to utilize one of the many libraries designed to parse these formats. As Google's Code Blog mentions:

"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."

Once authenticated, the Data Export API allows read-only access to Analytics data through GET requests. Data can be filtered in many ways, including date range, country, AdWords Campaign, and much more. Google has also provided Data Export client libraries for Java, through the GData Java client library, and for JavaScript, in the GData Ajax API Loader.

Polaris, a cross-platform Google Analytics desktop app.

Google Code's Analytics page features links to several third party applications that use the Data Export API. Polaris, the first product from Desktop Reporting, is a cross platform desktop Google Analytics widget built using Adobe's AIR environment (more at our Polaris profile). The Data Export API can also be used to create clients for on-the-go administrators to access data from their mobile devices. Analytics app company youcalc has created an embeddable Key Metrics Change web widget that's designed to display well on the iPhone as a web app.

Key Metrics for Google Analytics

With the addition of this API and the new Google O3D API, there are now 50 Google APIs in our directory.

Be sure to read the next Widgets article: Google Launches Web Elements: Easy Copy and Paste Widgets