views:

78

answers:

2

Hi guys,

I am trying to find out whether I can expose my own variables to GA? I want to expose things such as a user's username or more importantly the type of user that logged in.

For me this is an important component for the following scenario: I want to know what type of users log in the most over a period of time. What features do each type of user hit the most?

From what I have read it seems impossible, according to Google's TOS, but I am sure someone must have the same needs as mine. Is there a way to do this with GA? What do I do? Are their any other alternatives, short of paying for an analytics service/tool or making my own?

Cheers.

A: 

Here's an idea, but it won't work with GA or other tag-based analytics, just with log analyzers: upload one or more 1x1 pixel white/transparent gifs to a server and include something like this on each page:

<img src="/myvars.gif?user=<?php echo $username; ?>" />
<img src="/myvars.gif?type=<?php echo $usertype; ?>" />

I presume that you are using PHP, but you can easily adjust it to your language of choice.

After this, use Queries report and filters to extract information you need. I'm not sure which analyzers support such kind of reports/filters and give you other details you mention (our product does, but it's not free), so you might want to research a bit.

vrad
+3  A: 

Google Analytics provides a way to group your users via custom visitor segmentation.

For instance, if you'd like to track visitors by their user profile, you can just write

pageTracker._setVar("subscribers")

where pageTracker is a GA tracker instance, and _setVar() is the method you can set a custom label to the visitor's session. Label is stored in the __utmv session cookie, and you only have to call it once at the beginning of the tracking session.

For further details, see the Visitor Configuration chapter in GA Developer's Guide.

Török Gábor