Tip for using SWFAddress and GoogleAnalytics together
March 4, 2007
Just a quick tip to save you a few minutes if you plan to use SWFAddress (as far as I know currently the best browser-back-button solution for flash) and GoogleAnalytics (for tracking) in a flash project:
- Don’t use getURL() elsewhere in your as-code! SWFAddress uses ExternalInterface internally and there are serious bugs if you try to use getURL() (for calling the GoogleAnalytics urchinTracker(), for example) and ExternalInterface in Internet Explorer. Simply use ExternalInterface instead of getURL() and everything works fine.
I don’t know if this is a general problem with getURL() and ExternalInterface or if it just happens in that particular combination. - SWFAddress calls the urchinTracker() internally. This can be a good thing if your site needs simple tracking (changes of the url) but with more detailed tracking chances are you don’t want SWFAddress to call the urchinTracker() but call it manually in your application where appropriate. It wasn’t obvious at first that SWFAddress does that…so you can comment out the lines with “track.call(this)” in swfaddress.js (in the uncompressed js-version 1.1 this is in line 202 and 303).
That’s it :)
Filed under: Flex/AS3
I think this is a general problem with getURL() and ExternalInterface. I had the same problem, but not with GoogleAnalatics. I just tried to call a javascript function after an ExternalInterface call. It didn’t work. I just became an empty Window. With ExternalInterface instead of getURL it works fine.
I’m glad I came upon this site during my swfaddress research. I normally wouldn’t comment but you are one of a few people who have posted ANY type of tips on swfaddress. Someone should post a real nice tutorial.
Thanks for this post!
I had a very weird problem with IE and ExternalInterface (using SWFobject though): after closing the browser window, new blank windows started to appear all over the screen. Using getURL() (only for IE) helped.
Great tip. I found out that this is only a problem in Internet Explorer, not in Firefox/Safari on my mac. – just in case some of you are confused!
you saved my week-end with this comment… thanx a lot and “danke schön” also (viel mals).
So do you need to have your urchin UI js code in the page that contains the swf?
How does SWFAddress know what UI number to use for tracking?
Tip : in the minified version it is on line 1