Recent search strings for ShortStat
My site is frequently visited by people who find it using search engines. To better understand the dynamics of the used search phrases, I’ve used ShortStat to see the most frequently used strings.
This approach has one flaw: I don’t a decent visibility on the trends — the phrases tend to change over the time and if some phrases are dominating the result set, the newcomers may not have even a possibility to enter to the list.
To elaborate the problem, “Shortstat” is one of the most frequently used search strings to find the site, thanks to several small improvements that I’ve made. But most people find the site using terms related to travelling, such as “harald+turku” and “taco bell in shanghai”.
I’ve solved the problem by adding yet another view in ShortStat for showing recently used search terms. Follow these simple instructions to get it working on your site:
- First, you have to alter your ShortStat database to include a timestamp column in the search terms table. Open a connection to your database, either using mysql command line client or a web interface, and issue the following command:
alter table si_shortstat_searchterms add ts timestamp(14);
This adds a column that automatically updates itself to the current date and time when the row is inserted or updated.
- Add the following line to the configuration.php:
$SI_display['timeformat'] = ‘H:i’;
- Add the contents of shortstat_recent_search_terms.txt file at the end of functions.php in your ShortStat install directory.
- Add the following code snippet to desired location at index.php in your ShortStat directory:
<div class="module"> <h3>Recent Search Strings <span>When</span></h3> <div><?php echo SI_getRecentKeywords(); ?></div> </div>
Now you should have a working system. You have to wait patiently until there has been enough search string entries to get the table filled with correct dates.
1. — Nov 20 2008