Tracking users in Flash

Posted on Monday 21 March 2005

When you work with plain HTML sites, you can use stats programs to get an idea of the behaviour of the users as they go through the site. When your site all Flash-based, you lose some information about user behaviour. Apart from the raw number of hits, there are a couple of things you might want to know:

  • How do users navigate the site?
  • Where do they come from?
  • How do they leave?
  • What grabs their attention?
  • How long do they stay?
  • Do they read the text?

Now there’s a simple way of keeping track of users using Remoting. On the Flash side of things, you set up a controller class and an information object class. On the server-side, you set up a service that contains two methods: one to give a unique id to each client and one to store events.

So you set up your controller class to connect to your service. You retrieve the unique id from the service. Then whenever there’s an action you want to store, you call the controller and ask it to send the server an information object along with the unique id. Typically this information object would contain several fields: absolute time, flash time (from getTimer()), information code (Load.Section or URL.get for example), and an extra data field where you can send labels or any other info you want. So you send this object to Remoting and the service can simply store this info in a database.

You can make this information as coarse or as fine as you want. You can easily see that using this method you can store info such as:

  • IP and referrer
  • Time spent in each section
  • Path from section to section
  • URLs clicked
  • Times spent doing nothing (presumably reading)

Using this info, you can know what’s working and what’s not on your site. This is exactly what I’ve done on the 5 1/2 corporate site. The data logging is sent through AMFPHP and stored in a MySQL database. I record everything users do on the site so that I can know how the site is doing.

Let me give you an example of how incredibly precise this info can be. The email listed on the site is not listed anywhere else, so I know that all emails routed to it are from the site and not from a business card for example. Now I received a resume from some kid at that email address and I was wondering what was his motivation with regards to the company. Looking at the headers of the email, I found his IP address. So I did a search in phpMyAdmin and found the guy! Indeed, he had come from a French directory, spent 1.5 seconds loading the site, then 5 seconds later went to the contact section, and 2 seconds later clicked on the email link. This was a resume spammer, a kid who sends resumes to every guy and his dog in the hopes of finding a job; not the kind of highly-motivated employee I would want. Try to find that kind of info from Apache logs!


WordPress database error: [Can't open file: 'wp_comments.MYD'. (errno: 145)]
SELECT * FROM wp_comments WHERE comment_post_ID = '59' AND comment_approved = '1' ORDER BY comment_date

No comments have been added to this post yet.

Leave a comment




Your e-mail address is never displayed. If you run into issues with SpamKarma blocking you, email me at $patrick->5etdemi(com)


RSS feed for comments on this post | TrackBack URI