Pages

Thursday, November 12, 2009

Tracking Flash with Google Analytics

You're clients will love it! And in the end you will know more about the sites you build and how to better drive traffic to certain areas! Win! Win!

Ok so I have been using Google Analytics for quite sometime now and I must say i love it! So if you don't know by now Google provides FREE website statistics that go above and beyond any stat tracking systems I have seen to date. Well that is for something that is FREE. Anyway I want encourage all of you to get out there and start using Google Analytics for all your flash site going forward. Its really very simple to implement into your flash sites and even track individual events that occur in each of your sites. Please see analytics.google.com for more information on setting up your personal analytics with google and to get the Javascript needed for the code below to work. With that said let's get on to some actionscript!

googleAnalytics.as (right click - save as)

/// GOOGLE ANALYTICS SIMPLE TRACKING

/// http://blogfordesigners.blogspot.com

import flash.external.ExternalInterface;

function gaTracking(page) {

ExternalInterface.call("pageTracker._trackPageview", page);

}

//end


Code for simple call

gaTracking("/flash/home");

//sends event to google's analytics system


Now what you can understand from this is... You can call this function during ANY event function etc that you so desire. And any string combination that you want to pass to it is fair game. Use best practices when passing in the strings though so its easier for you and your clients to read when you all are reviewing the numbers. Ok so thats that! Cheers!


0 comments:

 

Sample text

Sample Text

Sample text