Access All Your Google Analytics Data in Flash/AIR Projects with ActionScript 3 Client Library

google-analytics-logo Google Analytics blog introduced a new ActionScript 3 Client Library, this library provides a simple way to access your Analytics Data from both AIR Applications and Flash Player (though a proxy). The developers an easily integrate Google Analytics into their Flash/AIR projects with this AS3 library.

“Given the potential value of this library to many other developers, we decided to make it freely available along with its source code,”

says Denis Bulichenko, Director of Business Development at DENIVIP.


It’s very simple to embed Google Analytics data into your Application:

1. Download AS3 Google Analytics API library SWC

2. Include SWC library into your project

3. Import library packages

// Main class
// Google Analytics Account
// Dimensions
// Metrics
// Filters classes
// View classes

4. Configure Google Analytics API request through APILoader class and initiate connection

// Create GA API connector
var apiloader_ga:APILoader = new APILoader();
// Initial configuration – ids=ga:12345
// Configure dimensions – check Developers Guide Dimensions section for details
apiloader_ga.setDimensions(new Array(new CampaignSourceDimension(), new CampaignMediumDimension()));
// Configure metrics – check Developers Guide Metrics section for details
apiloader_ga.setMetrics(new Array(new VisitorVisitsMetric(), new VisitorBouncesMetric()));
// Configure filter – check Developers Guide Filters section for details
apiloader_ga.setFilter(new Filter(new FilterItem(new CampaignMediumDimension(), new FilterOperator("=="), "referral" )));
// Configure segment
var sgm:Filter = new Filter(new FilterItem("gaid::10"));
sgm.addFilterItem("OR", new FilterItem("dynamic::ga:medium", new FilterOperator("=="), "referral"));

// Timeframe setup, pay attention that months are zero based in AS3
var start_date:Date = new Date(2010, 10, 9);
var end_date:Date = new Date(2010, 11, 8);
apiloader_ga.setPeriod(start_date, end_date);

// Set callback (returns array of DataFeedResponse objects)

// Configure view (process data and prepares everything in your way)

// Connect and begin data loading
apiloader_ga.connect(new GAAccount("", "pwd"));

You can get this open source library from here and you also can find the QuickStart Guide and GA API documentation.

Share and Enjoy:
  • Digg
  • Facebook
  • Google Bookmarks
  • DZone
  • Reddit
  • Technorati
  • StumbleUpon
  • Twitter
RSS Enjoy this Post? Subscribe to

RSS Feed   RSS Feed     Email Feed  Email Feed Follow us Follow us
You can leave a response, or trackback from your own site.

One Response to “Access All Your Google Analytics Data in Flash/AIR Projects with ActionScript 3 Client Library”

  1. Rich Tretola says:

    Looks like this swc is no longer available at the link you listed, can you send me a copy?

Leave a Reply