Just updated from 2.2 to 3.0 and noticed that user role segmentation was no longer happening. It looks like the profile module is required to be active in order for any segmentation to happen even if all you want is user roles:

if (module_exists('profile') && !empty($profile_fields)) {

A patch is attached.

CommentFileSizeAuthor
googleanalytics-profile.patch614 bytesgilgabar

Comments

gilgabar’s picture

Status: Active » Needs review
hass’s picture

Status: Needs review » Needs work

This may not work if you configure fields and than you disable the profile module. Then profile field settings exists, but profile module is disabled what may throw errors/warnings/notices.

sdsheridan’s picture

why not just put

    elseif ( in_array( 'roles', $profile_fields ) ) {  // we're just segmenting on roles
      $segmentation = '_gaq.push(["_setVar", ' . drupal_to_js(implode(',', $user->roles)) . ']);';
    }

after that if statement?

Shawn

hass’s picture

Title: User segmentation requires profile module » User segmentation via 'User roles' does not require profile module
Status: Needs work » Fixed

Committed #1 patch, after one more review.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.