After reading an article on Macromedia's DevNet (Advanced Flash Tracking), I thought I would offer up a solution that has been working successfully for me for the past year and a half. It is clear that Macromedia has spent a lot of time drafting that document. The solution I'm going to show you is not quite as advanced as their proposed solutions, but has some advantages on it's own. It's very easy to implement and it does not rely on JavaScript.
For every action you want to track, you simply need to add a function call to the event handler. The track function looks something like this:
function trackUser (whichAction, userId) {
// dummy.html is just a blank html page
loadVariables("/tracking/dummy.html?action="+whichAction+"&userId="+userId);
}
You'll need to set up a blank html page somewhere on your website for this to work (in the above example, place a blank html page "dummy.html" in the "tracking" folder under the web root). The reason this works is because Flash will attempt to load information from the html page and in doing so it will pass along some parameters to that page. Because the html page is blank, nothing is ever returned to the movie. However, an event is recorded in the server log that the page was requested, and the parameters passed to the page are recorded as well.
An example use case might look like this (using the function defined above):
// userId will need to be passed into the
// movie via the object/embed tags
// more info on passing variables into a movie:
// http://www.macromedia.com/support/flash/ts/documents/set_variables.htm
portfolio_btn.onRelease = function() {
// record that a user with id "userId" has
// clicked on the view portfolio button
trackUser("portfolio", this._parent.userId);
// handle the button click action now that
// we've tracked the click
this._parent.gotoAndStop("portfolio");
}
You can then analyze your server logs to see which actions have been taken, how many times they have been taken, etc. With a tracking package such as WebTrends, you can set up "parameter analysis" and it will automatically parse the server logs for you and display the results in a nice easy to read format.
Note that I've been using this approach successfully with IIS and WebTrends. Your results may vary.
I recommend you read Macromedia's take on tracking first before trying to implement a tracking solution in your Flash application. My propsed solution is easy to implement and doesn't rely on JavaScript so it may be better suited to fit your tracking needs.

3 Comments
Compelling idea to use the preexisting server-infrastructure. And probably softer on the server then a tracking solution with a server-side script and a database. Thanks for sharing!
Posted by: Andreas Weber | February 4, 2004 3:25 PM
Ok its my blond hair I have no idea how to do this. I just want to track our flash buttons (our marketing advertisments) to see how many people click on them. I have VERY little knowoledge of Action Script so please bear with my stupidty.
How do I get your example to work?
Do I need to put that function (how ever it works?) with the othe other code in the button or somewhere else?
Any help would be totally appreciated!
Thanks!
Matthew
Posted by: Matthew | August 12, 2004 10:53 AM
Hi Darron,
Following the last posted comment, is there any way you could post up a working example as I have no idea how to implement your findings in my flash site? If not, perhaps ud be so kind as to send an FLA by email?
Best
Stephen
Posted by: Stephen | October 15, 2004 5:36 PM