### Eclipse Workspace Patch 1.0
#P drupal-contrib-6--1
Index: modules/google_analytics/googleanalytics.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/google_analytics/googleanalytics.admin.inc,v
retrieving revision 1.2.2.7
diff -u -r1.2.2.7 googleanalytics.admin.inc
--- modules/google_analytics/googleanalytics.admin.inc 30 Dec 2007 01:22:08 -0000 1.2.2.7
+++ modules/google_analytics/googleanalytics.admin.inc 30 Dec 2007 22:54:19 -0000
@@ -122,6 +122,14 @@
$form['advanced']['googleanalytics_cache']['#description'] .= ' '. t('Public file transfers must be enabled to allow local caching.', array('!url' => url('admin/settings/file-system', array('query' => drupal_get_destination()))));
}
+ $form['advanced']['googleanalytics_site_search'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Track site search'),
+ '#description' => t('If checked, search keywords are tracked. You must configure your Google account to use the query parameter search. For more information see How do I set up Site Search for my profile.', array('!url' => 'http://www.google.com/support/analytics/bin/answer.py?answer=75817&ctx=sibling')),
+ '#default_value' => variable_get('googleanalytics_site_search', FALSE),
+ '#disabled' => (module_exists('search') ? FALSE : TRUE),
+ );
+
$form['advanced']['googleanalytics_codesnippet'] = array(
'#type' => 'textarea',
'#title' => t('JavaScript Code'),
Index: modules/google_analytics/googleanalytics.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/google_analytics/googleanalytics.install,v
retrieving revision 1.4.2.4
diff -u -r1.4.2.4 googleanalytics.install
--- modules/google_analytics/googleanalytics.install 30 Dec 2007 13:05:17 -0000 1.4.2.4
+++ modules/google_analytics/googleanalytics.install 30 Dec 2007 22:54:19 -0000
@@ -24,6 +24,7 @@
variable_del('googleanalytics_trackfiles');
variable_del('googleanalytics_cache');
variable_del('googleanalytics_last_cache');
+ variable_del('googleanalytics_site_search');
}
Index: modules/google_analytics/googleanalytics.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/google_analytics/googleanalytics.module,v
retrieving revision 1.16.2.10
diff -u -r1.16.2.10 googleanalytics.module
--- modules/google_analytics/googleanalytics.module 30 Dec 2007 20:39:16 -0000 1.16.2.10
+++ modules/google_analytics/googleanalytics.module 30 Dec 2007 22:54:19 -0000
@@ -116,6 +116,13 @@
}
}
+ // Site search tracking support.
+ $url_custom = '';
+ if (module_exists('search') && variable_get('googleanalytics_site_search', FALSE) && arg(0) == 'search' && arg(1) == 'node') {
+ $keys = search_get_keys();
+ $url_custom = url('search/node', array('query' => 'search='. urlencode($keys)));
+ }
+
// Should the legacy code be used?
if ($legacy_version) {
$script = '\n";
@@ -127,7 +134,7 @@
if (!empty($codesnippet)) {
$script .= $codesnippet;
}
- $script .= 'urchinTracker();';
+ $script .= 'urchinTracker('. (!empty($url_custom) ? '\''. $url_custom .'\'' : '') .');';
$script .= "\n";
}
else {
@@ -141,7 +148,7 @@
$script .= $segmentation;
}
$script .= $codesnippet;
- $script .= 'pageTracker._trackPageview();';
+ $script .= 'pageTracker._trackPageview('. (!empty($url_custom) ? '\''. $url_custom .'\'' : '') .');';
$script .= "\n";
}