/customers/iconara.net/iconara.net/httpd.www/blog/wp-content/plugins/wp-super-cache/wp-cache-phase1.php Iconara » How to save $149

How to save $149

Some jokers who call themselves flexinmotion have released a ridiculously overpriced Flex component which “will automatically track all user navigation clicks, button click, check boxes, radio buttons and a number of other controls within your app automatically” using Google Analytics. Let me show you how to save those 149 bucks.

There is a demo application on their site (which I find no reason to support by driving traffic to) that shows more or less what their component does. Basically it traverses your Flex application’s component hierarchy and registers itself as an event listener on all buttons, check boxes, tabs, etc. When an event is dispatched from any of these it reports it to Google Analytics.

Let’s put aside the fact that the data it reports to Analytics is completely useless and see how you can do this yourself.

The basics of using Analytics with Flash and Flex is this call (using the newer ga.js tracking code):


That’s all you need. There is no magic to get Analytics to work with Flash or Flex, you just use the ExternalInterface to call a JavaScript function.

That was half of the $149, the other half is the automatic tracking of all clicks in the application. This can be achieved with something like this:

function registerListeners( component : IUIComponent ) : void {
  if ( component is Container ) {
    var children : Array = Container(component).getChildren();

for each ( var child : IUIComponent in children ) {

} else if ( component is Button ) { component.addEventListener(MouseEvent.CLICK, handleEvent); } else if ( ... ) { // ... and so on for all the other types of // events and components } }

function handleEvent( event : Event ) : void { ExternalInterface( "pageTracker._trackPageview", "/" + event.currentTarget + "/" + event.currentTarget.data ); }

Just kick it off with


Although I wouldn’t recommend it (and the code above most definitely wouldn’t compile). There’s not much more to the “Flex Google Analytics Magic component” as far as I can tell.

The output from their demo application looks like this:


The first part is the toString value of event.currentTarget and the second part is the value of event.currentTarget.data, or something like that. Pretty lame to say the least, and entirely useless. It will tell you nothing about the usage of your application, partly because the data is without context and badly formatted, but also because Analytics wasn’t made to track events like these, but page views. You would be able to see things like the most clicked button, or the average number of clicks per session, but what use is that?

A better way to do it

If you want a useful way to work with Google Analytics and Flex, read the docs on Flex’ BrowserManager, then check out my SWFAddress/BrowserManager integration kit, which makes BrowserManager work seamlessly with SWFAddress instead of Adobe’s embed code.

Why would you want to use SWFAddress for deep linking instead of Adobe’s code (besides theirs being a complete mess)? and what does this have to do with Google Analytics? Well, the nice thing with SWFAddress is that as of v2.1 it will do all the talking with Analytics for you, behind the scenes, automatically. With BrowserManager and my integration code, you get deep linking and Google Analytics tracking in one go.

I should also say that instead of tracking events you should track the application state (e.g. the user is in the browsing-pictures state) or something more similar to page views, at least until the coming event tracking system in Analytics is released.

6 Responses to “How to save $149”

  1. Nick Says:

    Whereas some of the things you said may be valid, I’m sure that there are less conceited ways of expressing your opinion.

  2. Henrik Says:

    Thanks for the useful tip. I agree with Nick, some basic respect would not hurt.

  3. Theo Says:

    I have no respect for those who want to sell software by promising things that are false and misleading. I think they deserve nothing but mockery and ridicule.

  4. Dan Says:

    I’d have to agree with Theo. This “magic component” is a borderline scam, especially at the price of $110, and a completely outrageous $275 for the component + source code. To make it worth any money at all I think they need to find some way to format all the click data in a way that would be remotely useful.

  5. Theo Says:

    Wow, they’ve lowered the price since I wrote this. Now it’s $39 cheaper, a pity that it’s no better.

  6. Backs Says:

    Hey Theo!

    nice “component”! :D. thanx for this article you are totally right… I will recreate their Slideshow i think.

    Happy coding..

Leave a Reply