#428710: Integrate with Google Analytics module

Someone was asking way back in the day for Node profile, but does anyone else see a benefit in making Content profile compatible with Google Analytics so that we can track advanced segments? For those of you not familiar with advanced segments, they allow you to track the actions and paths of, say... users from Rhode Island (not sure why you'd want to), female users, users who list an interest in a certain thing -- whatever you want to ask in profile fields! Terribly powerful feature of GA.

So yeah, I just realized that this is one of the few areas where user profiles still had a leg up -- basically I'm completely gung-ho on content profiles, especially since it integrated with the Auto assign role module, but this is the one thing that might hold people back from trying it.

Anyhow, does anyone know whether this is even possible with the module architecture that's in place?

Cheers all!

Comments

josepvalls’s picture

I'm very interested in this feature too.

iva2k’s picture

subscribing

Same problem posted on Google Analytics #427566: Can't track user profile data - it won't be solved there however.

freatida’s picture

Very interested in this, would be really useful.

hass’s picture

josepvalls’s picture

I don't think it's a duplicate.
I don't my huge content profile loaded in each user object, I just want the segmentation bit.

hass’s picture

If the user object is extended, it would automatically work. I do not plan to create exceptional code for every module. It's for sure a duplicate

patcon’s picture

You're right, it's definitely a duplicate, but do you mind if we leave this one open? Segmentation is pretty key, and I'm sure there's a need for it, although I completely understand if it isn't something you're prepared to jump into.

So would anyone know whether there's a better solution than bloating the user object with all the content profile info. Might it be possible to indicate which fields are integrated into the user object? Could this be useful for other modules as well, aside from just Google Analytics? Any thoughts?

hass’s picture

I think design wise or object oriented wise the right way is to extend the user object with the extended user data. This would make it very easy to use in any module. It was refused by the maintainer, but I still think it's a wrond decission.

I'm not using the Content profile module myself, that's the only reason why I haven't cared much in past... Here are more people requesting this - so you may be successfully now :-)

rburgundy’s picture

+1 subscribing

vivianspencer’s picture

+1 subscribe

hass’s picture

Only as a note. I have implemented module_invoke_all('load_profile') in the ga module. So you are free to implement the hook for content profile.

josepvalls’s picture

I took a look into that.

What branch is that into?
What should it return?
How does it set the settings for the admin?

patcon’s picture

locomo’s picture

+1 important change IMO - really need to be able to segment our users

NancyDru’s picture

Has anyone tried the RealName module to see if it gives you what you want here?

Gabriel R.’s picture

Very interested in this. I need to segment on things like country or language.

baff’s picture

subscribe

maybe this is a solution
http://drupal.org/node/770586 #2

KingMoore’s picture

I think it is as easy as adding the following code to a custom module (w/mymodule_init renamed of course):

/**
 * implementation of hook_init()
 * 
 * add profile node to $user object
 */
function mymodule_init() {
  global $user;
  $user->profile = content_profile_load('profile', $user->uid);
}

Downside is it adds 35ms to my query log because node_load is slow. Are there other problems with this approach that I have not run into?