Produces a list of popular queries used to search your Google Search Appliance (GSA) that can be included on your search home page.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


TITLE: Popular Queries for GSA
CREATOR: dave olsen, wvu web services


‘Popular Queries for GSA’ offers administrators of stand-alone Google Search Appliance boxes the ability to include in their layout, via a JavaScript include, a list of the previous days top queries. Administrators can also have reports of the top queries emailed to them. To prevent users from including inappropriate queries in the list, ‘Popular Queries for GSA’ also includes the ability to censor queries.


v1.1 features:

  • Produces a JavaScript include that contains popular queries that can
    easily be embedded into your GSA templates
  • Logs in and out of your GSA automatically
  • Censors naughty words
  • Emails daily reports of top search queries to whomever you want
  • Tracks clicks on popular queries using Google Analytics
  • Deletes generated reports to keep your GSA reporting interface clean


WVU is now including popular queries on our search page.


  1. Google Search Appliance (tested on 4.6.4)
  2. PHP 5 or greater
  3. PECL_HTTP (tested on 1.5.6 & 1.6.3)



To check if you have it installed already type the following at the command prompt:

php -m

If you have it already you’ll see the module ‘http’ listed. If you don’t see it type the following at the command prompt:

pear -d memory_limit=16M install pecl/pecl_http

You’ll then need to edit your php.ini file. Add the following to the extensions section of it:

Download ‘Popular Queries for GSA’

You can do this two ways. If you use Git you can type the following
at the command prompt in the directory* you want this installed:

git clone git://

Alternatively you can also download it by clicking the green download
link on:

  • - git will create a directly called popular-queries-for-gsa so no
    need to duplicate it


First copy to This way future
changes to the settings file won’t overwrite your defaults.

All settings (e.g. GSA username/password) for ‘Popular Queries for GSA’
are located in You can also enable or disable features
in that file.

Note #1: In the current release (v1.0) the “bad words” filter is not very
robust and should be edited.

Note #2: While ‘Popular Queries for GSA’ doesn’t need to be in a web-
accessible folder (and probably shouldn’t) the $path_to_include should
be to a web-accessible folder.

Set-up Cron Jobs

To automate generation of your popular queries include file edit your
crontab. If you need to use a different account to run the cron jobs
make sure that account has appropriate permissions to write to the
popular-queries-for-gsa log & cookie store folders.

Example cron jobs follow. The first job runs at 12.30am and the second
at 12.45am.

30 0 * * * php /path/to/generate_report.php
45 0 * * * php /path/to/export_and_build.php

Customizing Look & Feel of ‘Popular Queries for GSA’

Via you can edit the general look and feel of your
popular queries list. The directions there should be fairly straight-
forward. By default ‘Popular Queries for GSA’ builds an unordered list.
Also, by default, each popular query link gets the class ‘recent_query’.

Adding the JavaScript Include to Your GSA Template

If you haven’t modified the XSLT for your GSA you may want to add the
following to the footer area. Note that if you do it will show up
on every page produced by your GSA. You also may want to make sure it’s
not a list.

1. Copy & paste the following code into your template:

<script type="text/javascript" src="http://location.of.include/recent_top_searches.js">
</script><noscript>No popular queries from yesterday to show.</noscript>

2. Update the src address.

3. Done!