Bake Cookies for your Visitors with Flash (editorial)
It is time to take the battle to those who think that Flash is synonymous with bad user experience. It is time for Flash developers to start thinking smarter about how they can use Flash on their web sites. We all know about the animation and interactivity that Flash offers, but what about personalization? What about customization? What about user profiling to delivers content that meets their needs?
Part of the solution to those questions can be found by integrating cookies with Flash. A cookie is a small text file that a web server sends to your browser. Your browser stores this file for the server to request later. This file does not contain any personal information that you have not shared with the web server (by filling in a form for example), and only the web server that wrote the cookie can read it. Most web servers use cookies to store your preferences for a site, or the contents of your shopping cart.
Recently a number of Flash sites have started using cookies to better deliver content to their users.
- Razorfish, Inc. implemented cookies on KPMG.com to make sure that you only see the intro movie on your first visit to the site
- Oil Services company Halliburton.com is using cookies to deliver either Flash or non-Flash content to your system
- Macromedia.com has recently started using cookies to let users pick their Flash preference
Reading cookies into Flash movies is easy. With a pretty simple JavaScript, developers can read the users cookie information and pass it into a Flash movie as a series of variables. Flazoom.com does this to personalize the site for our Flazoomers and anyone who posts a comment on our reviews. Any information that is stored in a cookie can be read into a Flash movie, and with simple ActionScripting, you can deliver custom content for each user.
Figure 1 |
Flazoom.com, in partnership with Virtual-FX.net commissioned MacGregor Media to develop a tutorial on reading and writing cookies using Flash.
There are many more benefits to using cookies with Flash than those listed above. Once you understand the basics of writing cookies, you will be able to develop smarter Flash movies for your site. Just think of the possibilities.
- Personalized Flash Movies
Once you have a cookie with your users name or e-mail address, you can auto-populate forms within your Flash movie. As in Figure 1, next time you come back to a page the form blanks are filled in with your name and comment. This technique is also used in the side bar to personalize Flazoom.com for our repeat visitors. - Intro Once!
Intro Movies can add value to a site, but if you are expecting your visitors to sit through an intro every time they visit, forget it! Set a cookie at the end of an intro movie to say that the user has seen it. Next time they come back, look for that cookie value and redirect them to the next page of your site. - Bandwidth Profiling
You can set a cookie value based on the speed of a users connection. Setting the cookie can be part of your pre-loader. Just check to see how long it took to load a certain movie and set the cookie value accordingly. Visitors that need a long load time (under 20k per second) have a low bandwidth connection and need content geared for low bandwidth delivery. Visitors with a short load time (over 20k per second) are high bandwidth users and can take all the bells and whistles. - Version Profiling
You can sniff the version of the Flash plug-in that a user has and write a cookie that has that value. Users with the latest Plug-in will be able to take advantage of Flash's printing features. Once Flash 5 is available, sniffing the plug-in version will be even more important. Once you know what type of plug-in your user has, you can deliver the right content to them. - Preferences
Offering control over various parts of the Flash file can increase the trust your visitor has in your content. Using cookies, you can remember your visitors preferences and set your Flash content to behave accordingly. If your visitor says he doesn't want background music, your Flash movie will know that next time he comes back.
With the competition for attention on the web, any steps that you can take to make your Flash content more customized for the needs of your visitors are steps you need to be taking. Integrating cookies into your Flash movies is a good step towards assuring a good experience for your visitors. I have listed only a few of the possibilities for Flash and cookies. There are many other solutions out there. As more and more Flash developers start thinking smarter about how they can use Flash on a web site, the critics of Flash will have less ammunition to knock the format. That is what we all want, and cookies are a way to achieve it.
Ciao,
CHris
Join the cookies and flash discussion, add your comments about this editorial.
Further Reading: