Accessibility
 
 
ColdFusion Connector for NetObjects 4.0
Capturing User Information

By Tom Molyneux, Fundere Software
In Information Rules, A Strategic Guide to the Network Economy, Carl Shapiro and Hal Varian write:

The other primary way to learn about your customers is by observing their on-line behavior. Most Web sites now allow users to search their contents. But the Web hosts rarely save users' queries. Knowing what your users are looking for--and whether they find it--is extremely valuable information; save it and analyze it.

The lesson below has been furnished by Fundere Software as a free "How-to" overview entitled "Capturing User Information". Following through this lesson will take about twenty-five minutes, and it involves creating a search engine for your site using ColdFusion's integration with Verity, and capturing visitor's queries in a database. By doing this you will see a practical implementation of the benefits described by Carl Shapiro and Hal Varian above.

Part I: Adding a Search Engine to Your Site

To add a search engine to your site, drop a Verity Site Search Component onto the page that you wish to serve as the search page for your site. The Verity Site Search Component is the seventh item Allaire Cold Fusion toolbar, and this component has five attributes:

  1. Collection: Enter a name for your Verity Collection. You may enter any name you wish. You will later create a Verity Collection with this name using the ColdFusion Administrator.
  2. URL Path: Enter the URL path to your site's home page. Do not leave a trailing slash. For instance, If your site is published to http://www.mycompany.com, enter this. All subdirectories will automatically be included.
  3. Directory Path: Enter the directory path that corresponds to the URL you entered for the URL Path attribute. For instance, if you are using Microsoft's IIS, your path may look like C:\Inetpub\wwwroot\mycompany. Do not leave a trailing slash.
  4. Extensions: Enter the file extensions, preceded by a period, of the document types you wish to include in your search. In this example, we are including all HTML, HTM, PDF, and DOC documents. See the ColdFusion documentation for a complete list of document types. The list should be comma delimited.
  5. Password: Enter a password. You may use this password to index your site after publishing. Initially, the collection is empty. Each time you index, you refresh the collection to reflect the current state of your site (like building a table of contents in Microsoft Word - you must refresh it after changing text). You should index your site after publishing.

In order to add your Verity collection to your site you will need to access the ColdFusion Administrator (on your web server), or have a good working relationship with someone inside your company that does. To perform this task, you'll need to go to the Verity link under Miscellaneous, and under "Add A Collection", enter the name of the Collection that you entered for the Collection attribute. From here, select the "Create" radio button, then click "Apply".

Now, in order to publish your site to your server, the server must be running ColdFusion. In your browser, go to the page that contains the Verity Site Search Component, and append "?reindex=password" (no quotes) to the URL where password is the value you entered for the Password attribute. For instance, http://www.fundere.com/lesson1/search/search.cfm?reindex=lesson1. Press Enter in your browser's location window to go to this URL, and this step will build/refresh the index.

You are now ready to search your site. Remember to refresh the index each time you publish your site.

Part II: Capturing User Information

In Part I we added a search to our NetObjects Fusion 4.0 site. But you can also capture the user's queries so that you may better understand what visitors are seeking. The form field in the search form is named "source", and is used later in this discussion.

In order to store your visitor's queries, you will need to create/use a database containing a table that contains a field named "source". (You may download a sample database at: http://www.fundere.com/lesson5/instructions/source.zip). Create a ColdFusion data source based on this database as shown here.

Next, we will need to use the CFInsert Component to insert the user's query into the table described above. Here are the steps for you to follow along:

  • Add a Non-visual Component Manager to the page.
  • Add a CFInsert Component to the Non-visual Component Manager.
  • Enter the name of the data source that you created in the previous step for the Data source attribute.
  • Enter the table containing the field named source for the Table name attribute.
  • Enter source for the Form fields attribute (Note: In our example, we created a data source named source with a single table named source. The single table contained two fields, one named source and one named source_ID).

We have now set up the form to enter the value that the visitor enters into the field into a database. However, the Verity Site Search Component submits to itself. Thus, the user may get to the page either by a link from another page or by pressing the submit button on the page itself. If the user merely selects the page, there will be no form field named source (they have not yet submitted the form). We must thus include conditional logic to check for the existence of a form field named "source". We will need to create an expression to evaluate if such a field exists.

Select the HTML tab of the CFInsert Component. Select the HTML Mode button. This allows us to edit the HTML directly. Next, select the Expression Builder. ColdFusion has hundreds of expressions that allow you to include many programmatic features. See the ColdFusion documentation for a complete list of functions. We will use the ColdFusion expression ParameterExists() to make sure that the form field named source does in fact exist. Select the "Other" from the list of expression types on the left. Then select the ParameterExists() function by double-clicking on it in the list on the right. You may edit the expression in the edit field above by entering "source" in the parentheses. This expression will evaluate to either yes or no (Boolean) depending if the parameter named source exists. Highlight the expression in the edit field, hit Control-C to copy it to your system's clipboard, and close the dialog.

 

If you've followed along this far, you're almost there. Now you're back in the CFInsert Component. At this point, you need to place conditional logic around the insert statement -- that is, only insert the field if it exists. Before the Insert statement, write <CFIF #ParameterExists(Source)#> (using the expression you just created). Place a </CFIF >after the insert statement to close it.

You may now republish your site, and all user queries will be stored in your database.

About Fundere Software
A private corporation, Fundere specializes in ColdFusion - NetObjects Fusion integration. Fundere provides training, on-site installation and support for clients using NetObjects Fusion with ColdFusion. Fundere also builds custom NetObjects components that integrate NetObjects with other web technologies.

For more information regarding Fundere, please contact:
Fundere Software
18 Horizon Ave.
Venice, CA 90291
Phone: (310) 392-1005
Fax: (310) 392-0800
Email: info@fundere.com