Posts Tagged ExternalInterface

Google Analytics For Flash; is it that usefull?

Not too long ago Google released Google Analytics for Flash. My first reaction was one of happiness; finally some attention would be put into Flash analytics. But after looking into it a bit more I found out that Google Analytics for Flash wasn’t such a big deal.

On Google Analytics side, nothing changed; no specific stats just for Flash,  just the good old interface we all know.  On the Flash side, nothing changed much there either; instead of doing this:

1
2
 
ExternalInterface.call("pageTracker._trackPageview('/somepage');");

You now do this:

1
2
tracker = new GATracker( this, "window.PageTracker", "Bridge", false );
tracker.trackPageview( "/somepage");

From the look of it, it’s actually more code than before.

The cool thing about GA for Flash is the ActionScript 3 mode. In that mode, you can call the tracker even if the JavaScript code wasn’t imported in the HTML page the Flash file is embedded. Now that is a possibility that we didn’t have before. So in a context where you do not have control over the HTML you flash will be embedded, this will enable you to do analytics just the same. I have also seen in the road map for the project that they want to implement it for Adobe AIR also; this will be very useful.

What will you be using Google Analytics for Flash for?

, ,

7 Comments


ExternalInterface Problems in ActionScript 2

Where I work we use a lot of Javascript because the guys doing it are quite gifted and also because I am the only member of the flash department (well designers do flash, but when it gets complicated I handle it), so it is often the case where Flash has to call a Javascript function. With all of my readings I had come to the conclusion that ExternalInterface.call was the best way to access Javascript functions. I guess I was wrong…

Well first of all ExternalInterface works very badly with Opera (at least the ActionScript 2 version, haven’t tested the ActionScript 3 version). Searching a bit I found people saying the it worked sometimes, it worked when it wasn’t inside a mouse related event, etc. Well this isn’t very reliable.

Also I ran in some trouble where when the Javascript was called in the html it worked fine in all browsers, when I used ExternalInterface it worked fine in Internet Explorer, didn’t do a thing in Opera and just crashed Firefox. Well that’s nice cross-browser behavior…

To solve my problem, I just had to do it the good old way; getURL(“javascript:myFunction()”). For the same Javascript function (the one that crashed FireFox), it worked in all browser. I hope this all works better in AS3.

, ,

3 Comments