03MaySWFAddress 2.1 supports Google Analytics

And it does it out of the box.

SWFAddress 2.1 is out and it supports Google Analytics with no extra effort. No code necessary except for the usual SCRIPT tags code provided by Google.

If you are like me and don't like to read all the fine print, keep in mind that you'll have to remove the following code

pageTracker._trackPageview();

from the HTML, because SWFAddress tracks the page view automatically for you. If you don't remove you'll end up with double page visits.

Pages are ready to be tracked. So now to track events:

public static function track(event:String):void
{
    ExternalInterface.call("pageTracker._trackPageview('"+event+"')");
}

And you are all set.


  1. 1 Joy07 Jan 2010

    Just want to say that this post is ESSENTIAL to every developer who works with SWFAddress and Google Analytics. It's such a small change that needs to be made, but it has big implications. I want to shout this post from the rooftop :)
    Thanks so much for the information.

  2. 2 The Chien20 Jan 2010

    Hi:

    just in case anyone makes the same stupid mistake as me (just spent about 1/2 hour until I realised) YOU MUST INCLUDE the class:

    import flash.external.ExternalInterface

    Otherwise it won´t work. In AS3 you always include/import everything, but switching back to AS2 I always forget to do this!!