Amazingly I couldn’t find any writeups about how to modify VPASP to capture on site search keywords into Google Analytics or the http logfile, etc. So I decided to take a look at shopsearch.asp looking for opportunities for a quick mod. I quickly found the location to add one line of code so that I could pass the search term as a querystring parameter to the shopdisplayproducts.asp template (search results page).

On the system at hand, the location was on/about line 57:

Change line
responseredirect "shopdisplayproducts.asp?Search=Yes&sppp=" & howManyItems
to
responseredirect "shopdisplayproducts.asp?Search=Yes&sppp=" & howManyItems & "&kwd=" & allwordsString

So, what we’re doing here is passing the ‘allwordsString’ variable (the search term) as a query string parameter value to ‘kwd’. ‘kwd’ could be anything unique on your system, but you’ll need to add whatever you call ‘kwd’ to the Google Analytics Site Search query string parameter setup in order to capture the data. (Let me know if you need more help with that part.)

The next improvement on this mini-project will be to pass some data into Google Analytics so that failed searches (on site search where search term generates zero results) can be quantified. More on that later…..

Leave a Reply

Learn more about what we do

Services