? analytics_i18n.patch
? analytics_i18n_6.patch
? google_analytics_i18n3.patch
Index: googleanalytics.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/google_analytics/googleanalytics.admin.inc,v
retrieving revision 1.2.2.47
diff -u -p -r1.2.2.47 googleanalytics.admin.inc
--- googleanalytics.admin.inc	28 Sep 2008 21:28:43 -0000	1.2.2.47
+++ googleanalytics.admin.inc	13 Oct 2008 19:56:02 -0000
@@ -195,6 +195,16 @@ function googleanalytics_admin_settings_
     $form['advanced']['googleanalytics_cache']['#description'] .= ' '. t('<a href="@url">Public file transfers</a> must be enabled to allow local caching.', array('@url' => url('admin/settings/file-system', array('query' => drupal_get_destination()))));
   }
 
+  // Allow for tracking of the originating node when viewing translation sets.
+  if (module_exists('translation')) {
+    $form['advanced']['googleanalytics_translation_set'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Track translation sets as one unit'),
+      '#description' => t('When a node is part of a translation set, record statistics for the originating node instead. This allows for a translation set to be treated as a single unit.'),
+      '#default_value' => variable_get('googleanalytics_translation_set', 0),
+    );
+  }
+
   $site_search_dependencies = '<div class="admin-dependencies">';
   $site_search_dependencies .= t('Depends on: !dependencies', array('!dependencies' => (module_exists('search') ? 'Search'. t(' (<span class="admin-enabled">enabled</span>)') : 'Search'. t(' (<span class="admin-disabled">disabled</span>)'))));
   $site_search_dependencies .= '</div>';
Index: googleanalytics.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/google_analytics/googleanalytics.install,v
retrieving revision 1.4.2.24
diff -u -p -r1.4.2.24 googleanalytics.install
--- googleanalytics.install	1 Oct 2008 07:02:08 -0000	1.4.2.24
+++ googleanalytics.install	13 Oct 2008 19:56:02 -0000
@@ -38,6 +38,7 @@ function googleanalytics_uninstall() {
   variable_del('googleanalytics_roles');
   variable_del('googleanalytics_visibility');
   variable_del('googleanalytics_pages');
+  variable_del('googleanalytics_translation_set');
 }
 
 /**
Index: googleanalytics.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/google_analytics/googleanalytics.module,v
retrieving revision 1.16.2.50
diff -u -p -r1.16.2.50 googleanalytics.module
--- googleanalytics.module	1 Oct 2008 06:49:06 -0000	1.16.2.50
+++ googleanalytics.module	13 Oct 2008 19:56:02 -0000
@@ -131,6 +131,19 @@ function googleanalytics_footer($main = 
       $url_custom = drupal_to_js(url('search/'. arg(1), array('query' => 'search='. $keys)));
     }
 
+    // If this node is a translation of another node, pass the original
+    // node instead.
+    if (module_exists('translation') && variable_get('googleanalytics_translation_set', 0)) {
+      // Check we have a node object, it supports translation, and its
+      // translated node ID (tnid) doesn't match its own node ID.
+      $node = menu_get_object();
+      if ($node && translation_supported_type($node->type) && isset($node->tnid) && ($node->tnid != $node->nid)) {
+        $source_node = node_load($node->tnid);
+        $languages = language_list();
+        $url_custom = drupal_to_js(url('node/' . $source_node->nid, array('language' => $languages[$source_node->language])));
+      }
+    }
+
     // Track access denied (403) and file not found (404) pages.
     if (function_exists('drupal_get_headers')) {
       $headers = drupal_get_headers();
