### Eclipse Workspace Patch 1.0
#P drupal-contrib-5
Index: modules/google_analytics/googleanalytics.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/google_analytics/googleanalytics.module,v
retrieving revision 1.14.2.22
diff -u -r1.14.2.22 googleanalytics.module
--- modules/google_analytics/googleanalytics.module	30 Dec 2007 01:48:30 -0000	1.14.2.22
+++ modules/google_analytics/googleanalytics.module	30 Dec 2007 11:22:24 -0000
@@ -42,15 +42,24 @@
  *   A decision on if the current user is being tracked by GAnalytics
  */
 function googleanalytics_track($account) {
-  $track = TRUE;
+  // By default we don't track users.
+  $track = FALSE;
 
   foreach (array_keys($account->roles) as $role) {
-    if (!variable_get('googleanalytics_track_'. $role, FALSE)) {
-      $track = FALSE;
+    // Add the tracking code if user is member of one role that should be tracked.
+    if (variable_get('googleanalytics_track_'. $role, FALSE)) {
+      $track = TRUE;
     }
   }
 
-  if ($account->uid == 1 && !variable_get('googleanalytics_track__user1', FALSE)) {
+  // Handle behavior for administrative user 1.
+  if ($account->uid == 1 && variable_get('googleanalytics_track__user1', FALSE)) {
+    // Enable tracking of user 1 if tracking for "authenticated user" is disabled.
+    $track = TRUE;
+  }
+  elseif ($account->uid == 1 && !variable_get('googleanalytics_track__user1', FALSE)) {
+    // User 1 is a member of "authenticated user". Disable user tracking
+    // if user 1 shouldn't, but "authenticated user" should be tracked.
     $track = FALSE;
   }
 
