I have a site that is using the Google Analytics (GA) module. It's happily tracking data to GA. However, I can't seem to get Site Search working.

The site uses Apache Solr. A search results page for the query "test" is: /sitesearch/test

  1. I've enabled "Track internal search" in the Google Analytics module config page
  2. I've enabled "Site search Tracking" in GA
  3. I've set the query parameter to "sitesearch" in GA
  4. I've unchecked "Strip query parameters out of URL" in GA
  5. I've confirmed that if I manually hit this URL, it pings a track in GA: /sitesearch/test?sitesearch=test (Any URL on the site with ?sitesearch=test works.)

I'm out of ideas. What could be causing this to fail?

2 Answers 2


The problem is that Google Analytics only supports site search tracking if the path is "search/something", not "sitesearch" as we use on my client's site.

Line 138ish from googleanalytics.module:

if (module_exists('search') && variable_get('googleanalytics_site_search', FALSE) && arg(0) == 'search' && $keys = search_get_keys()) {
  $url_custom = '(window.googleanalytics_search_results) ? ' . drupal_to_js(url('search/'. arg(1), array('query' => 'search='. drupal_urlencode($keys)))) . ' : ' . drupal_to_js(url('search/'. arg(1), array('query' => 'search=no-results:'. drupal_urlencode($keys) .'&cat=no-results')));

looks like query param changed to "keys" so that should be updated in the GA interface

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.