? add_og_segmenation.patch Index: googleanalytics.admin.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/google_analytics/googleanalytics.admin.inc,v retrieving revision 1.4.2.12 diff -u -p -r1.4.2.12 googleanalytics.admin.inc --- googleanalytics.admin.inc 8 Mar 2009 11:38:26 -0000 1.4.2.12 +++ googleanalytics.admin.inc 28 Jul 2009 11:16:16 -0000 @@ -129,7 +129,16 @@ function googleanalytics_admin_settings_ '#size' => (count($fields)>10) ? 10 : count($fields), '#multiple' => TRUE ); - + + if (module_exists('og')) { + $form['segmentation']['googleanalytics_og_segmentation'] = array( + '#type' => 'checkbox', + '#title' => t('Segment users by Organic Groups'), + '#description' => t('All groups will be tracked'), + '#default_value' => variable_get('googleanalytics_og_segmentation', FALSE), + ); + } + // Link specific configurations. $form['linktracking'] = array( '#type' => 'fieldset', Index: googleanalytics.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/google_analytics/googleanalytics.module,v retrieving revision 1.19.2.10 diff -u -p -r1.19.2.10 googleanalytics.module --- googleanalytics.module 1 Apr 2009 18:10:36 -0000 1.19.2.10 +++ googleanalytics.module 28 Jul 2009 11:16:17 -0000 @@ -95,8 +95,8 @@ function googleanalytics_footer($main = if (!empty($id) && _googleanalytics_visibility_pages() && _googleanalytics_visibility_user($user)) { - // Add User profile segmentation values. - if (is_array($profile_fields = variable_get('googleanalytics_segmentation', '')) && ($user->uid > 0)) { + // Add User profile / OG segmentation values. + if ((is_array($profile_fields = variable_get('googleanalytics_segmentation', '')) || variable_get('googleanalytics_og_segmentation', FALSE)) && ($user->uid > 0)) { $p = module_invoke('profile', 'load_profile', $user); @@ -110,6 +110,15 @@ function googleanalytics_footer($main = $fields[$field] = $value; } + + // add OG segmentation. + if (variable_get('googleanalytics_og_segmentation', FALSE) && isset($user->og_groups)) { + $groups = array(); + foreach($user->og_groups as $nid => $group) { + $groups[] = $nid . '-' . check_plain($group['title']); + } + $fields += $groups; + } // Only show segmentation variable if there are specified fields. $segmentation = '';