summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhass2007-12-30 11:20:12 (GMT)
committer hass2007-12-30 11:20:12 (GMT)
commit084a10a365a9c95160a10d2dcdd0ec5d54f5541c (patch)
treeeed378cc92f781cb383cf533e57694345d0caa65
parent0b7be7dc5fcf4805898cbcdf4a727de7bd3098a9 (diff)
#186677: Tracking code does not appear in page code
-rw-r--r--googleanalytics.module17
1 files changed, 13 insertions, 4 deletions
diff --git a/googleanalytics.module b/googleanalytics.module
index a79dca1..825e7a4 100644
--- a/googleanalytics.module
+++ b/googleanalytics.module
@@ -217,15 +217,24 @@ function _googleanalytics_cache($location = 'http://www.google-analytics.com/urc
* 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;
}