Use Macromedia Flash Local Shared Objects Instead of Cookies

Leverage the ubiquity of Macromedia’s Flash and Local Shared Objects instead of cookies.

Recent data presented by JupiterResearch suggests that the availability of cookies for use in measurement applications is at greater risk than many previously believed. One response to the “decline of cookies” is to look for other systems for tracking new and returning visitors. This hack describes a workaround based on Macromedia Flash’s Local Shared Object. According to the fine folks at Macromedia:

Shared Objects are used to store data on the client machine in much the same way that data is stored in a cookie created through a web browser. The data can only be read by movies originating from the same domain that created the Shared Object. This is the only way Macromedia Flash Player can write data to a user’s machine. Shared Objects can not remember a user’s e-mail address or other personal information unless they willingly provide such information.

The important pieces of this definition are “much in the same way that data is stored in a cookie, " “can only be read by movies originating from the same domain that created the Shared Object, " and “Shared Objects can not remember a user’s e-mail address or other personal information unless they willingly provide such information.” Put another way, Local Shared Objects are a perfect replacement for cookies because they’re just as secure and just as harmless.

The JavaScript Code

The following ...

Get Web Site Measurement Hacks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.