Solved

Tracking specific search criteria used in search form and passed to dynamic page with cfquery

Posted on 2011-02-24
4
409 Views
Last Modified: 2013-12-24
Hello Experts,

I have been running the same search form for years, passing search criteria to a dynamic results cfm page that uses cfquery to display the results. I had someone ask if we are able to track the search terms used in order to determine which search criteria is most common. The search form page is a restaurant search whereby a visitor can select 1 of 4 options: cuisine, location, price or restaurant name. They specifically wanted to know which cuisine search was used most often. My form page passes the search criteria to the results page "internally", rather than within variable URLs, so I am not sure that this is possible. While I can certainly view the statistics within my stats software for the results page, there is no breakdown, as far as what people searched for, when bringing up this page. In general, the process is:

index.cfm -- search form page:

<FORM ACTION="diningresults.cfm" METHOD="POST">
--select cuisine from dropdown list OR
--select location from dropdown list OR
--select price range from dropdown list OR
--enter restaurant name keywords

SUBMIT search...

diningresults.cfm:

<CFIF busname IS NOT "">
  <CFOUTPUT QUERY results...
<CFIF cuisine IS NOT "">
  <CFOUTPUT QUERY results...

...etc.

So, because only the page "diningresults.cfm" is called, is there any way to track what search criteria was used? If so, could someone share how I might go about doing that? I'm thinking I would need to modify things to pass variables via the URL; i.e. "diningresults.cfm?cuisine=#cuisine#" or something like that? Or do I actually need to track something within the Access database itself? Or, am I missing something obvious, that I can do with the current system? Any insights would be most appreciated. Thank you!
0
Comment
Question by:tam423
  • 2
  • 2
4 Comments
 
LVL 39

Accepted Solution

by:
gdemaria earned 500 total points
Comment Utility
You can change the method to GET instead of POST

<FORM ACTION="diningresults.cfm" METHOD="GET">

That would put the search items on the URL.

This has the added benefit of making the URL bookmark-able, like google, you could cut and paste the search results into an email to show someone else... etc.

ALternatively, you could store the search criteria in the database.
0
 

Author Comment

by:tam423
Comment Utility
qdemaria,

Thanks again for your help! I made that change and bingo -- the variables are in the URL. Guess I've been woefully ignorant about METHOD="GET". I did a few test queries, but I probably won't be able to see if my stats will show these query strings passed to the diningresults.cfm file until at least sometime tomorrow, when things get generated for the previous day -- do you happen to know if using METHOD="GET" will result in us being able to now track the specific search criteria used?
0
 
LVL 39

Expert Comment

by:gdemaria
Comment Utility
> do you happen to know if using METHOD="GET" will result in us being able to now track the specific search criteria used?

The criteria will be on the URL, so if your web stats can handle it (depends on the software), then I should think that is all you need.

Alternatively, you can store searches in the database and run reports yourself.


0
 

Author Comment

by:tam423
Comment Utility
gdemaria,

Yes, I think, too, that this will work fine. We use SmarterStats Enterprise and I looked around a little and found that a query string parameter report can be generated on a dynamic page, so I think I'm good to go, at least from this point on. If not, for some reason, I will go the route of storing the searches in the database. Thank you -- again -- for your quick response and excellent help!
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

PROBLEM: How to add your own buttons to the bottom toolbar with paging info ( result count ). While creating a cfgrid, I ran into an issue where I wanted to embed my own custom buttons where the default ones ( insert / delete / etc… ) are for aes…
This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now