Ajax Metrics

Lightweight usage statistics for Web 2.0 sites

Ajax Metrics Project

Other Projects

What is it

Ajax Metrics is a free service that helps you track usage statistics in your Ajax applications. It's a web analytics tool, similar to Google Analytics, but aimed specifically at Ajax and Flash applications. Here are sample reports you can see within minutes:

Browse through user sessions:
browsing user list

Drill down on a particular user; see every action they performed, across sessions:
drill down on actions of a particular user

Vision

Site owners want to know how their sites are used. Usage statistics give business intelligence to the Web; if you don't know what customers are doing on your site, it's hard to improve their experience.

The feedback loop of action-centric metrics is even more important to Web 2.0 websites, which pride themselves in customer love and agility. Since many new sites are one-page-wonders, regular statistics packages like Google Analytics don't work well. Tools for capturing user actions are not available for Ajax applications, and site owners resort to building their own, custom solutions. This takes effort and money away from their core business.

The creator of this project had to build his own analytics package for the CocktailBuilder website. The resulting stats viewer for that website is publicly available. If you're interested in more information about the history of the idea, take a look at this blog article.

Getting Started

1) Sign up for a free AjaxMetrics account. Takes 30 seconds or less.


2) Include the following few lines of JavaScript, somewhere in the HEAD section of your HTML:

<script src="http://www.ajaxmetrics.com/jsapi/compressed/ajaxmetrics.js"
      type="text/javascript"></script>
<script type="text/javascript">
      AjaxMetrics.start("your_product_key");
</script>

The parameter passed to the start method is your product key, unique per-site.

What's the size of that JavaScript file you're including? 3KB


3) Any time you want to track an event in JavaScript, just call

AjaxMetrics.track(eventName, eventData);

Here eventNameis some identifier that will help you remember the datapoint context. Feel free to use descriptive strings (they won't be sent across the wire every time, don't worry :-). For example, for CocktailBuilder, I use event names like ADD_INGREDIENT_BY_NAME or COCKTAILS_SEARCH_BY_SUBSTRING.

For eventData, you can pass in any JavaScript object - string, array, real object, or even null.

Here's a sample call to the track function from CocktailBuilder:

AjaxMetrics.track("COCKTAILS_SEARCH_BY_INGREDIENTS", userIngredients);


4) Any time you want to track an event in Flash, just call

ExternalInterface.call("AjaxMetrics.track", eventName, eventData);

eventData can be an ActionScript object, it will be converted into a JavaScript object automatically, and survive intact all the way. Thanks to Theo Hultberg for researching this!