Flash, Ajax and Google Analytics

Flash and Ajax applications don’t register in the server logs as the good old HTML-based websites did. I’ve hacked my own solutions to this, because it’s always interesting to know what visitors are doing, how many they are and what the find interesting.

To get server logs of a Flash or Ajaxified site, create a file on the server and load that file with a different parameter for every “page” you want to track. I put “page” in quotes since what consitutes a page isn’t always entierly obvious in the context of Flash and Ajax.

But, over the last year I have started to use Google Analytics, which is a rather good tool for getting an overview of your site’s statistics. Today I looked through the documentation and found a page named “How do I track Flash events”. It’s not rocket science, but I thought I’d share this knowledge with you.

It’s as simple as including the analytics JavaScript-snipplet as usual on the page that embeds the Flash application, and then call the tracker code from within Flash, Google suggests this code:

getURL("javascript:urchinTracker('/custom/path');");

You can do it with the ExternalInterface, too, but the code above works fine.

I’m thinking of expanding my state handling class into a small module which provides different kinds of state handling, and something which automatically calls a server side script or the Google Analytics tracker code would definitely be included.

3 Responses to “Flash, Ajax and Google Analytics”

  1. kichus Says:

    Hi

    Just found this post through technorati and the title attracted me… I ‘d a similar post about the same issue, “Web Analytics for Flash sites” and thought of sharing my views with you. You can go through that post using the following URL: http://www.kichus.in/2006/11/21/web-analytics-flash-sites/. Hope this will give us more to learn.

    all the best, kichus

  2. Alex Says:

    I’m working on a new analytics platform explicitly designed for Ajax applications – http://www.ajaxmetrics.com – and I’d love to hear what you have to say about it.

  3. Theo Says:

    I think Ajax Metric looks promising. Google Analytics and server log statistics can’t tell you much about how your users use your application and Ajax Metrics seems to solve that problem. I’m looking forward to seeing more.

Leave a Reply