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.

AttachmentSize
googleanalytics og tracking.patch1.65 KB

#1

hass - March 8, 2009 - 12:03
Status:needs review» needs work

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

hass - July 13, 2009 - 08:46

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

gcassie - July 13, 2009 - 13:49

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.

AttachmentSize
googleanalytics og tracking 2.patch 1.72 KB

#4

manarth - July 28, 2009 - 11:22
Status:needs work» needs review

+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.

AttachmentSize
add_og_segmentation.patch 2.51 KB

#5

hass - August 6, 2009 - 22:04

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

tobias - August 27, 2009 - 08:50

+1 also interested.

#7

hass - August 27, 2009 - 11:19
Version:6.x-2.0» 6.x-2.x-dev
Status:needs review» needs work

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.

 
 

Drupal is a registered trademark of Dries Buytaert.