Posts Tagged ga.js

SWFAddress 2.1 and the new Google Analytics Tracker

I had made a previous post about how to integrate the new Google Analytics Tracker and SWFAddress. It wasn’t obvious but it was fairly easy. I guess people really asked for an even easier way to do it because the new javascript code(ga.js) now works with SWFAddress without indicating to it that you are not using the Urchin tracker. As a matter of fact, with the release of SWAddress 2.1 earlier this week, the support for the ga.js tracker is one of the update. Other updates include a lot of fixes for the SEO examples and also the AS2 and AS3 classes are now in the com.asual.swfaddress.

I really have to look into the SEO  example that was released along version 2.0. It is one of my goal for the next month along to getting to know PureMVC better.

, , , ,

No Comments


SWFAddress and the new Google Analytics (ga.js)

I’m always playing a bit with SWFAddress, SWFObject and Google Analytics. SWFAddress has a nice features which is that it will advise Google Analytics when you change a page inside your main swf movie. That gives you the ability to do tracking on your website. Pretty neat!

Has some of you might know, Google Analytics has released a new tracker code (from urchin.js to ga.js). What more does it do for you right now? Not much, it’s supposed to be smaller in size and that’s about it. No event yet (there was a lot of buzz around events in Google Analytics and there is actually documentation on how to implement them but they are still in closed beta; we will have to wait on this one), no new functions. But if your launching a new website I would advise putting the new tracker code (ga.js) because it will save you maintenance time when you will want the new features.

So does SWFAddress works with the new code? Well the answer is yes, and it is pretty easy to make it work here is sample code showing you how to do it:

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-xxxxxx-xx");
pageTracker._initData();
</script>
<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript" src="js/swfaddress.js?tracker=pageTracker._trackPageview"></script>

The most important part of the code is the last line where you tell SWFAddress which tracker to use. That’s it! I hope this saves you some time.

, , ,

23 Comments