How to Track Clicks in Flash Files with
Google Analytics

March 31, 2010

Recently at the University of Northern Colorado we launched our new brand, “Bringing Education to Life”. As part of the launch the web team was charged with coming up with a landing website for the brand.

The site was created in Flash and when you click on different links, it uses the UILoader component in flash to display other Flash files. Each of these clicks is recorded in the log files, but our analytics tool doesn’t count .SWF flies.

Google Analytics Tracking:

On each of the clickable items there is this code.

navigateToURL(new URLRequest(“javascript:pageTracker._trackPageview(‘/life/component/” + e.currentTarget.theURL + “‘)”), “_self”);

Basically, it tells the Google Tracker to register a click. Above I tell the tracker to register at the url /life/component/itemname

Here is what it looks like in Google Analytics:

Google Analytics

Basic Code:

Imports:

import flash.net.navigateToURL;

import flash.net.URLRequest;

Code:

navigateToURL(new URLRequest(“javascript:pageTracker._trackPageview(‘theURL to register ‘)”), “_self”);

Tags: ,

Comments are closed.