Extending User Defined Segmentation In GA
The user defined segment based on the value of the _utmv cookie.
You set the value of this cookie with the __utmSetVar() function in urchin.js or with pageTracker._setVar() if using ga.js.
To view the user defined segment in your analytics, go to >Visitors->User Defined.
You currently use the _utmv cookie to segment your employees’ actions from other visitors, as well as exclude them from certain profiles.
For our example, we set the emplyee’s cookie value to “notrack”. (Justin Cutroni has a great post explaining what this is and how to do it.)
Now, you want to track your members separately from other visitors. You’ve configured your login page to set the _utmv cookie to “member” upon successful authentication. Now, they’ll be tracked as a part of the “member” segment for any pages they view.
The problem is that once your employees log in, their “notrack” cookie is overwritten with the “member” cookie.
On their next visit, it’ll look like they’re a regular member. (We don’t want that.)
To set the _utmv cookie, we would normally just place the code below on the landing page after the user logs in.
However, this would overwrite any _utmv cookie that was previously set. (ie, our “notrack” cookie)
* For ga.js, just replace “__utmSetVar(‘member’);” with “pageTracker._setVar(‘member’);”.
Your body onload event should now look like the example below:
What does it do?
Instead of automatically setting the _utmv cookie every time, we check to see if the cookie is already set. (It doesn’t matter what it’s set to. If it’s “member” already, we don’t need to set it again, and if it’s “notrack” we don’t want to set it again.
Now, when your employees log into your site, they’ll continue to be tracked or excluded as such.
I hope this helps to expand everyone’s use of the _utmv cookie. With a little logic, you don’t need to be bound to using the _utmv cookie for only one type of user. I welcome your questions, comments, and suggestions.