### 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.8
diff -u -r1.2.2.8 googleanalytics.admin.inc
--- modules/google_analytics/googleanalytics.admin.inc 2 Feb 2008 23:52:39 -0000 1.2.2.8
+++ modules/google_analytics/googleanalytics.admin.inc 4 Feb 2008 19:43:32 -0000
@@ -122,12 +122,26 @@
$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()))));
}
+ $site_search_dependencies = '
';
+ $site_search_dependencies .= t('Depends on: !dependencies', array('!dependencies' => (module_exists('search') ? 'Search'. t(' (enabled)') : 'Search'. t(' (disabled)'))));
+ $site_search_dependencies .= '
';
+
+ // Google already have many translations, if not - they display a note to change the language.
+ global $language;
+ $form['advanced']['googleanalytics_site_search'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Do Track Internal Search'),
+ '#description' => t('If checked, internal search keywords are tracked. You must configure your Google account to use the internal 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?hl='. $language->language .'&answer=75817')) . $site_search_dependencies,
+ '#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'),
'#default_value' => variable_get('googleanalytics_codesnippet', ''),
'#rows' => 15,
- '#description' => t('Paste custom code snippets here. These will be added to every page that Google Analytics appears on. For help with this feature see the cutroni.com blog. Do not include the <script> tags, and always end your code with a semicolon (;).', array('@snippets' => 'http://drupal.org/node/39282', '@blog' => 'http://cutroni.com/blog/'))
+ '#description' => t('Paste custom code snippets here. These will be added to every page that Google Analytics appears on. For help with this feature see the cutroni.com blog. Do not include the <script> tags, and always end your code with a semicolon (;).', array('!snippets' => 'http://drupal.org/node/39282', '!blog' => 'http://cutroni.com/blog/'))
);
return system_settings_form($form);
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 4 Feb 2008 19:43:32 -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 4 Feb 2008 19:43:32 -0000
@@ -116,6 +116,18 @@
}
}
+ // 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='. $keys));
+ }
+
+ // Surround custom urls with single quotes.
+ if (!empty($url_custom)) {
+ $url_custom = '\''. $url_custom .'\'';
+ }
+
// Should the legacy code be used?
if ($legacy_version) {
$script = '\n";
@@ -127,7 +139,7 @@
if (!empty($codesnippet)) {
$script .= $codesnippet;
}
- $script .= 'urchinTracker();';
+ $script .= 'urchinTracker('. $url_custom .');';
$script .= "\n";
}
else {
@@ -141,7 +153,7 @@
$script .= $segmentation;
}
$script .= $codesnippet;
- $script .= 'pageTracker._trackPageview();';
+ $script .= 'pageTracker._trackPageview('. $url_custom .');';
$script .= "\n";
}