Fun with Google Analytics in the Flash IDE with AS3
There’s always External Interface method. Some good tutorials on this out there too.

So far I found 1 Flashcoders post about a bug in IE7 that doesn’t allow the use of this technique.

People seem to be complaining about unwanted popup windows with this method. It seems to work fine for me in the browser, both locally and off a server. Popup windows only show up with Test Movie, which, while annoying, will not be an issue with clients.

Google’s AS3 component / SWC library
Google has an Analytics component and an Analytics Library component that doesn’t require any javascript on your page and talks to their analytics system directly. Only problem seems to be it adds between 60KB and 40KB to your file size. The cool part – you don’t have to rely on Javascript at all.

SWFaddress for Google Analytics tracking
There’s a way to use SWFaddress 2.0 together with ga.js to track page views in Flash sites.

There’re a few posts from 2007 that utilize the global function sendToURL().

/* ... */
var trgtURL:URLRequest = new URLRequest("javascript:pageTracker._trackPageview('mypath/mypage_link');");
/* ... */

This technique wouldn’t work & gave me a security error every time, both during Test Movie and from a live server. I suspect the Flash player security changes between 9,0115 and 10 banned this method. Here’s the error: “Security Error: Error #2169: The method sendToURL may not be used for browser scripting. The URL javascript:pageTracker._trackPageview…”

getURL() ?
Oh, I hope not…

Something like this should work OK, given you import all the proper classes & Google’s javascript code is on the html page that displays your .SWF:


		public function trackTheGoogley(trackString:String):void
			} else {
				navigateToURL(new URLRequest("javascript:pageTracker._trackPageview('"+trackString+"')"), "_self");