Tracking with Google Analytics from Flash
Just a quick update on the Google Analytics work I have been doing in-amongst writing a desktop application to detect proxy settings (maybe more on that later)…
I have completed the move from development to live server and have implemented some code for Flash banners to call the Google Analytics JavaScript _trackPage function. Its really simple stuff but as I have done 2 examples (one in Actionscript 2 and one in Actionscript 3) for the client to be able to supply the creative departments of advertisers (as they usually create the banners and supply .gif or in this case .swf files) I thought I might as well post the examples. For those people trying to find there way with Actionscript 3, a button click action is now triggered by an Event (MouseEvent.CLICK) and interestingly a call to some JavaScript in the page that embeds the Flash file is now called using the ExternalInterface class (it won’t work with the old method of calling the function from the getURL method). For example:
ExternalInterface.call("pageTracker._trackPageview('/clks/adv/insert-name-here')");
Replaces:
getURL("javascript:pageTracker._trackPageview('/clks/adv/insert-name-here');");
Anyways, here are the examples for download.
It’s basic but it might help someone ![]()
