Index: googleanalytics.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/google_analytics/googleanalytics.module,v
retrieving revision 1.36.2.34
diff -u -r1.36.2.34 googleanalytics.module
--- googleanalytics.module	7 Feb 2011 14:16:20 -0000	1.36.2.34
+++ googleanalytics.module	7 Feb 2011 16:38:48 -0000
@@ -94,6 +94,30 @@
       drupal_add_js(array('googleanalytics' => $link_settings), 'setting', 'header');
       drupal_add_js(drupal_get_path('module', 'googleanalytics') .'/googleanalytics.js', 'module', 'header');
     }
+
+    $script .= '(function() {';
+    $script .= 'var ga = document.createElement("script");';
+    $script .= 'ga.type = "text/javascript";';
+    $script .= 'ga.async = true;';
+
+    // Should a local cached copy of ga.js be used?
+    if (variable_get('googleanalytics_cache', 0) && $url = _googleanalytics_cache('http://www.google-analytics.com/ga.js')) {
+      // A dummy query-string is added to filenames, to gain control over
+      // browser-caching. The string changes on every update or full cache
+      // flush, forcing browsers to load a new copy of the files, as the
+      // URL changed.
+      $query_string = '?'. substr(variable_get('css_js_query_string', '0'), 0, 1);
+
+      $script .= 'ga.src = "' . $url . $query_string . '";';
+    }
+    else {
+      $script .= 'ga.src = ("https:" == document.location.protocol ? "https://ssl" : "http://www") + ".google-analytics.com/ga.js";';
+    }
+    $script .= 'var s = document.getElementsByTagName("script")[0];';
+    $script .= 's.parentNode.insertBefore(ga, s);';
+    $script .= '})();';
+
+    drupal_add_js($script, 'inline', 'header');
   }
 }
 
@@ -227,28 +251,6 @@
       $script .= $codesnippet_after;
     }
 
-    $script .= '(function() {';
-    $script .= 'var ga = document.createElement("script");';
-    $script .= 'ga.type = "text/javascript";';
-    $script .= 'ga.async = true;';
-
-    // Should a local cached copy of ga.js be used?
-    if (variable_get('googleanalytics_cache', 0) && $url = _googleanalytics_cache('http://www.google-analytics.com/ga.js')) {
-      // A dummy query-string is added to filenames, to gain control over
-      // browser-caching. The string changes on every update or full cache
-      // flush, forcing browsers to load a new copy of the files, as the
-      // URL changed.
-      $query_string = '?'. substr(variable_get('css_js_query_string', '0'), 0, 1);
-
-      $script .= 'ga.src = "' . $url . $query_string . '";';
-    }
-    else {
-      $script .= 'ga.src = ("https:" == document.location.protocol ? "https://ssl" : "http://www") + ".google-analytics.com/ga.js";';
-    }
-    $script .= 'var s = document.getElementsByTagName("script")[0];';
-    $script .= 's.parentNode.insertBefore(ga, s);';
-    $script .= '})();';
-
     drupal_add_js($script, 'inline', 'footer');
   }
 }
