info@golden-fire.com     (484) 85-SPARK  

Goldenfire Productions Blog

Tracking Flash Events in Google Analytics

gaforflashYou want that all flash website, or looking to see how users progress through a flash application, but have been told time and time again that your analytics program can’t track flash. By itself your analytics package can not, but with some creative coding and careful planning, you can have full analytics from flash in most web analytic platforms. 

As Google Analytics is the platform choice for small businesses, lets look at how to set up flash for event tracking.

By using the javascript tracking tags on your site, Google Analytics allows you to track flash actions along with other javascript actions. From menu selections, ajax reveals, you can get creative with what you are looking to track. You can even set your flash video players to track how long a user watched a video. 

Option 1:

Use the _trackPageview function

You can assign a page filename to any Flash action with this function, and enter that filename into the appropriate goal or funnel step. Important: Please note that your Analytics tracking code and calls to _gat._getTracker must be placed on the page above the call to _trackPageview.

  1. To track an event, call _trackPageview() with an argument specifying a name for the event. For example, calling: pageTracker._trackPageview(“/purchase_funnel/page1.html”);
    will cause each occurrence of the the calling Flash event to be logged as though it were a pageview under the name /purchase_funnel/page1.html. The argument must begin with a forward slash and be in quotes. 
  2. The event names may be organized into any directory style structure you wish. The path/filename argument to _trackPageview need not represent an actual URL on your website.

 

Flash Code Examples
on (release) {
// Track with no action
getURL("javascript:pageTracker._trackPageview('/folder/file.html');");
} 
on (release) { 
//Track with action 
getURL("javascript:pageTracker._trackPageview('/folder/file.html');"); 
_root.gotoAndPlay(3); 
myVar = "Flash Track Test"; 
}
onClipEvent (enterFrame) {
getURL("javascript:pageTracker._trackPageview('/folder/file.html');");
}

 

Option 2:
tracking-flash-google-analyticsA more advance option is to use the open source Google Analytics for Adobe Flash Component.

The GA for flash tracking component enables you to track specific events and functionality in your flash movies and seamlessly communicate with Google Analytics for tracking. It gracefully handles any DOM issues that could cause problems in other types of flash tracking using GA. 

For tutorials on how to implement GAforFlash into your Flash applications visit these sites. 

http://code.google.com/p/gaforflash/
http://www.hmtweb.com/blog/2009/02/how-to-track-flash-in-google-analytics_08.html
http://www.insideria.com/2009/02/using-google-analytics-within.html