Project:Google Analytics
Version:6.x-2.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (duplicate)

Issue Summary

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.

AttachmentSizeStatusTest resultOperations
googleanalytics og tracking.patch1.65 KBIgnored: Check issue status.NoneNone

Comments

#1

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

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.

AttachmentSizeStatusTest resultOperations
googleanalytics og tracking 2.patch1.72 KBIgnored: Check issue status.NoneNone

#4

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.

AttachmentSizeStatusTest resultOperations
add_og_segmentation.patch2.51 KBIgnored: Check issue status.NoneNone

#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

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.

#8

+++ googleanalytics.admin.inc 28 Jul 2009 11:16:16 -0000
@@ -129,7 +129,16 @@ function googleanalytics_admin_settings_
+  ¶
...
+ ¶

Leading blanks need to be removed,

+++ googleanalytics.module 28 Jul 2009 11:16:17 -0000
@@ -95,8 +95,8 @@ function googleanalytics_footer($main =
+    if ((is_array($profile_fields = variable_get('googleanalytics_segmentation', '')) || variable_get('googleanalytics_og_segmentation', FALSE)) && ($user->uid > 0)) {

No longer applies to DEV

+++ googleanalytics.module 28 Jul 2009 11:16:17 -0000
@@ -110,6 +110,15 @@ function googleanalytics_footer($main =
+          $groups[] = $nid . '-' . check_plain($group['title']);

check_plain() seems not to make sense to me as the string goes into Javascript and not HTML and drupal_to_js will kill invalid chars a few lines later.

Do we really need this extra array $groups? As longer as I'm looking into this code I guess we may only need to make the "og_group" item selectable in the UI fields selection and we may be done. But I could be wrong as we do not habe the $nid then.

Powered by Dreditor.

#9

Also needs implemented with _setCustomVar as setvar is deprecated.

#10

subscribing... any more interest in this?
Or should I just use http://drupal.org/project/og_user_roles and derive the GA data from the role membership?

#11

Status:needs work» closed (duplicate)

As setVar is deprecated I mark this as a duplicate of #609892: Multiple custom variables and hope that the values you are interrested in are available via tokens.

#12

+1 for adding this feature

#13

Sorry I never came back to this one. I moved on from the project it was being used in and it fell off my radar.

nobody click here