Index: googleanalytics.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/google_analytics/googleanalytics.module,v
retrieving revision 1.54
diff -u -r1.54 googleanalytics.module
--- googleanalytics.module	1 Oct 2010 23:43:11 -0000	1.54
+++ googleanalytics.module	5 Oct 2010 23:39:59 -0000
@@ -125,8 +125,8 @@
 
     // Site search tracking support.
     $url_custom = '';
-    if (module_exists('search') && variable_get('googleanalytics_site_search', FALSE) && arg(0) == 'search' && $keys = search_get_keys()) {
-      $url_custom = drupal_json_encode(url('search/'. arg(1), array('query' => 'search='. $keys)));
+    if (module_exists('search') && variable_get('googleanalytics_site_search', FALSE) && arg(0) == 'search' && $keys = googleanalytics_search_get_keys()) {
+      $url_custom = drupal_json_encode(url('search/'. arg(1), array('query' => array('search' => $keys))));
     }
 
     // If this node is a translation of another node, pass the original
@@ -326,6 +326,23 @@
 }
 
 /**
+ * Helper function for grabbing search keys. Function is missing in D7.
+ *
+ * http://api.drupal.org/api/function/search_get_keys/6
+ */
+function googleanalytics_search_get_keys() {
+  static $return;
+  if (!isset($return)) {
+    // Extract keys as remainder of path
+    // Note: support old GET format of searches for existing links.
+    $path = explode('/', $_GET['q'], 3);
+    $keys = empty($_REQUEST['keys']) ? '' : $_REQUEST['keys'];
+    $return = count($path) == 3 ? $path[2] : $keys;
+  }
+  return $return;
+}
+
+/**
  * Tracking visibility check for an user object.
  *
  * @param $account
