Markus Johnsson
Markus Johnsson

Reputation: 4019

Google Analytics - Group by custom variable value

I want to track visitors to a web site. I want to track them by "organization" and "username" in google analytics. I then want to be able to group users by organisation. Today I have this code:

_gaq.push(['_setCustomVar', 1, 'Organization', theOrganization]);
_gaq.push(['_setCustomVar', 1, 'UserName', theUser]);

Note that both variables has the same "index or slot" (1), which means that the variables are listed under the same "key" in the google analytics app. It seems to me that only one of those values gets set though and it makes me think that I should use different index/slots/keys. (Such a great thing when the names are the same throughout the service and docs)

However, I'm not sure that I can use the data even after I change the slot - I cannot find a way to do the "group by organization" operation. When I select "secondary dimension" in the reports view I cannot find "custom variables" in there.. Is it at all possible?

Upvotes: 0

Views: 1376

Answers (1)

jaygooby
jaygooby

Reputation: 2536

You need to use a slot per different key:

_gaq.push(['_setCustomVar', 1, 'Organization', theOrganization]);
_gaq.push(['_setCustomVar', 2, 'UserName', theUser]);

Then to filter Organization by UserName you'll need to make a custom report; use the custom variable values (not their keys)

Custom variables in dimension drilldowns

Save the report, and then you can choose the relevant Organizations in the initial filter and you'll see the UserNames for that org

Upvotes: 1

Related Questions