Segmentation by Organic Groups
gcassie - February 20, 2009 - 19:10
| Project: | Google Analytics |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs work |
Description
The attached patch should add the option to do segmentation tracking based on user's OG memberships.
Segmentation by OG seems like a good idea because they tend to indicate user interests, and are usually aggregate so they don't violate the Google TOS.
Right now it tracks all groups, but it could be expanded to provide the option to exclude certain groups, or types of groups.
| Attachment | Size |
|---|---|
| googleanalytics og tracking.patch | 1.65 KB |

#1
We should check if module_exists('og'). Otherwise I think we would have in 99.8% a non-existing $user->og_groups. I'm also not sure if this could be undefined if OG is installed and a user is not a member of any OG group. Code need to be E_ALL save. Maybe !empty($user->og_groups) can help... but I haven't tested this at all.
#2
We are close to the next release... If you'd like to see this feature integrated, please provide feedback, update the patch or close the case, please.
#3
Attached is an updated patch with validity checks. Checking for isset($user->og_groups) should be sufficient because if og is not enabled, og_user doesn't fire, and that value never gets loaded.
Also, I've been using the original patch on a site with about 50K accounts and it is working well.
Hope this is found useful.
#4
+1 for adding this feature to the module.
The patch above appears to apply to 6.x-2.0 - applying against 6.x-2.2 or DRUPAL-6--2 branch fails.
Attached patch is rolled for DRUPAL-6--2 branch.
#5
How about creating optgroups for profile and OG and maybe other settings. This would allow us not to have not uncountable more checkboxes... I've never done this myself with Drupal Form API yet, but found this http://drupal.org/node/318099#comment-1047817 (untested). Not sure if we need to check out #475740: form_select_options will leave options outside optgroups if array is not ksorted.
What do you think about this UI and usability wise?
#6
+1 also interested.
#7
googleanalytics_segmentation should become a multidimensional array with a key of "profile" and "og" having an array with values. The selection should use optgroups. I believe this is the most extensible way to implement it if other modules need this, too.