You are currently browsing comments. If you would like to return to the full story, you can read the full entry here: “Google Analytics Custom Segmentation by Role in Drupal”.
You are currently browsing comments. If you would like to return to the full story, you can read the full entry here: “Google Analytics Custom Segmentation by Role in Drupal”.
Very good post!
First, Sorry for my bad english (I’m spanish).
A question: Where did you put this code? only in footer of Staff’s pages?
I work in a project that web has a lot of role users. How can i track separately all role users ?
Thanks a lot!,
Alex.
The code is in the theme’s footer. The PHP code part used the user’s roles to conditionally print two extra variables.
"if($user->uid && in_array('staff',$user->roles)){If you want to track lots of groups you would use different values for a given variable.
'pageTracker._setCustomVar(SLOT,VARIABLE_NAME,VARIABLE_VALUE,SCOPE);'You can have up to 5 custom variables in Google Analytics, and each variable can have as many possible values as you want.
More info here: https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingCustomVariables