Click to return to the Web Content Management home page    
Web Workshop  |  Web Content Management

Collecting Personal Information from Your Users Easily with the Microsoft Profile Assistant and Internet Explorer 4.01


Ray Sun
Microsoft Corporation

January 12, 1998

No time to read this article? Run the Profile Assistant demo (requires Internet Explorer 4.01 Non-MSDN Online link). I'd recommend that you read the sections below first, though.

Note   We've fixed a few bugs in the Profile Assistant in Internet Explorer 4.01, so you must install Internet Explorer version 4.01 before using the Profile Assistant.

Contents
Introduction
Populating the Client Data Store
Requesting Personal Information
How the Demo Works
Conclusion

Introduction

Web sites typically need to obtain personal information from their users in order to register them, to perform electronic commerce, or to customize the information presented to them. Typically, this is done with a simple HTML form. The problem with this method is that users browsing the Internet today must type in the same data time and time again: name, address, phone numbers, e-mail, and so on. With the Profile Assistant in Microsoft Internet Explorer 4.01, you can save your users the hassle of this repetitive data entry, so they will have more time to enjoy your site (which may mean more sales!).

The Profile Assistant makes it easy for users to share registration and demographic information with sites that require this information while maintaining their privacy. At all times, the user has complete control over access to his or her data. User information is stored securely in protected storage on the client's computer. Web servers can request this information, but it is shared only if users give their consent in the Profile Assistant confirmation dialog box. When a Web site requests information for the first time, the dialog box prompts the user for permission (this is mandatory for privacy reasons). By default, however, the dialog box is not redisplayed once the user chooses to provide this information. From a privacy standpoint, the dialog box is not any more intrusive than an HTML form -- the Profile Assistant just makes the collection of information easier.

In line with Microsoft's commitment to standards, the Profile Assistant is compliant with the current P3P (Platform for Privacy Preferences) privacy recommendations set by the W3C (World Wide Web Consortium), the independent body governing standards for the Internet. In addition, it is supported by companies such as Firefly and NetPerceptions.

TopBack to top

Populating the Client Data Store

Before a Web site can request personal information, the user must enter his personal data once. The user can enter personal data into the secure client profile storage (the Windows Address Book) by using an edit dialog box inside the Internet Explorer browser. This dialog box is accessible through the Content tab in the View/Internet Options dialog box. However, the user may not have entered all the information requested by a specific site, so Internet Explorer also provides a way for the user to edit his personal information when the Web site asks for it. It does so by providing an Edit Profile button inside the Profile Assistant confirmation dialog box, which is presented when the user reaches that Web site.

TopBack to top

Requesting Personal Information

Run the demo to see how the Microsoft Profile Assistant simplifies the collection of personal information.

If you have not already entered the personal information used by the Profile Assistant, you will need to click Edit Profile when the Profile Assistant dialog box prompts you for personal data. This step is not required after the first time you enter this data.

Note   To run this demo a second time, you will have to go to Internet Explorer's View/Internet Options menu, click the Content tab, and click Reset Sharing.

TopBack to top

How the Demo Works

The Web site collects all of its information through simple JavaScript or Visual Basic Scripting Edition (VBScript) code. An excerpt of the code required for the demonstration in JavaScript is shown below. You can write code very similar to this for your Web site.

Information is collected through a simple four-step process:

Step 1. Check to see that the client is Internet Explorer 4.01. If not, the HTML form will not be automatically filled out, but there are no negative side effects.

// Check for Internet Explorer version 4.01
    var MS = navigator.appVersion.indexOf("MSIE");
    window.isIE401 = (MS > 0) && 
      navigator.appVersion.substring((navigator.appVersion.lastIndexOf("MSIE") + 
      4),navigator.appVersion.lastIndexOf(";")) >= 4.01;
 
    // Do nothing if the client is not IE 4.01. This will leave the form empty.
    if (window.isIE401)
{

Step 2. Queue up a list of requests for information from the user, such as First Name, Last Name, and Address, by calling addReadRequest. Queuing is done so the user is not presented with separate dialog boxes for each piece of data requested.

var profile = navigator.userProfile;
 
    // Clear the request queue to remove any previous 
    // addReadRequest calls
    profile.clearRequest();

    profile.addReadRequest("Vcard.FirstName");
    profile.addReadRequest("Vcard.LastName");
    profile.addReadRequest("Vcard.Home.StreetAddress");
    profile.addReadRequest("Vcard.Home.City");
    profile.addReadRequest("Vcard.Home.State");
    profile.addReadRequest("Vcard.Home.Zipcode");
    profile.addReadRequest("Vcard.Home.Phone");
    profile.addReadRequest("Vcard.Business.Phone");

Step 3. Do a read request by calling doReadRequest. The Profile Assistant dialog box is presented to the user, prompting him to allow or deny access to the private profile information. In addition, you present the user with a usage code that tells the user how you intend to use the information. (See http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/doreadrequest.asp for a complete list of usage codes.) This is important because the most widely cited reason for not registering at a Web site today is not knowing how the collected information will be used.

// This presents the Profile Assistant dialog box.
// 2 is a usage code; "Acme Computers" is the company name 
    profile.doReadRequest(2,"Acme Computers");

Step 4. Once the user allows access to the profile information, the form is filled out on the client's machine. Individual attributes are returned by calling getAttribute. These should be the same attributes requested by addReadRequest. If the user denies access to a particular attribute, a null value is returned, and that form field remains blank.

// Shipping is the HTML form name
    Shipping.txtFirstName.value = profile.getAttribute("Vcard.FirstName");
    Shipping.txtLastName.value = profile.getAttribute("Vcard.LastName");
    Shipping.txtStreet.value = profile.getAttribute("Vcard.Home.StreetAddress");
    Shipping.txtCity.value = profile.getAttribute("Vcard.Home.City");
    Shipping.txtState.value = profile.getAttribute("Vcard.Home.State");
    Shipping.txtZip.value = profile.getAttribute("Vcard.Home.Zipcode");
    Shipping.txtDayPhone.value = profile.getAttribute("Vcard.Business.Phone");
    Shipping.txtEvePhone.value = profile.getAttribute("Vcard.Home.Phone");

// Clear the request queue for future Profile Assistant calls
    profile.clearRequest();
}

TopBack to top

Conclusion

With these four easy steps, you can save your users the time and effort previously required to enter common personal information if they are using Internet Explorer 4.01. Users who are running earlier versions of Internet Explorer or users of other browsers will need to type in their personal information manually through your HTML form, instead of having the Profile Assistant do it automatically (as long as you check for Internet Explorer 4.01 before running the script, as described in Step 1 above). This means that you need to author only one page for all browsers.

For more information on the Profile Assistant, see the Overview at http://msdn.microsoft.com/workshop/management/profile/profile_assistant.asp.



Back to topBack to top

Did you find this material useful? Gripes? Compliments? Suggestions for other articles? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.