So, a few months back I posted on how to view the exact AdWords search queries your visitors use to reach your site (a feature that is, so far, unsupported out of the box with Google Analytics). My method involved grabbing that keyword phrase and storing it within Google Analytics’ User Defined field. In the article, I said:

“There are lots of great applications for the User Defined variable… If you can get by without using it, you can then save the User Defined field for something else that might prove more powerful. Like tracking search terms. :)”

I’ll be the first to admit that this statement is a little wishy-washy. What are these great applications? Why save it for tracking exact search queries? What precisely does the User Defined variable do?

In a nutshell, you use the User Defined variable to perform custom segmentation on your visitors. Google Analytics already provides a number of built-in segmentation features. It’s so intuitive, most users probably aren’t even aware that what they’re doing is segmentation. From your Traffic Sources report, you see a specific group of visitors that came in from a specific source, and you click the hyperlink. Now, you’re looking solely at the data for that source. Congratulations! You’ve sliced and diced your data down to a very specific segment of traffic.

So, you can segment your traffic by visitor type (new or returning), by source (where, how, why they came to your site), by organic search queries, by browsers or screen resolutions or Internet speed… but what if you want to get a little more specific?


The way Custom Visitor Segmentation works is that you watch for a specific user action on your site: the visitor answers a survey, they become a member, they make a transaction for a certain amount from your online store. The moment this action takes place, you label the visitor accordingly: “Male”, “Member”, and “Big Spender”.

It’s pretty easy to do. Just make sure that whenever the right action is completed, you run a simple JavaScript function to label them. So, when the survey form is submitted the visitor answers that they are “Male,” you just make it so that the following snippet of JavaScript runs:

__utmSetVar(‘Male’);

You may have to do a little programming, depending on how complicated your action is. Sometimes, though, it’s as simple as running that script whenever the visitor hits a certain page. Let’s say that you want to segment your members from non-members? Easy. Just make sure that whenever your visitors log into the Members Only area, you run the JavaScript:

__utmSetVar(‘Member’);

The function creates a cookie called __utmv and stores your custom segment inside the cookie. The contents of the cookie will show up in your Google Analytics report as the User Defined segment.

Custom visitor segmentation is just that: custom. You get to choose how to label your visitors as unique, distinct segments. Here’s the thing, though: a custom segment on one site may be completely useless for another. So, it’s difficult to say for sure what types of segments you should employ with your own Google Analytics profiles. You need to think long and hard and make sure that it’s a segment you’ll actually use during data analysis.

To make it even harder to choose what segment to use, there is only one custom variable for you to use. You can only give your visitors one label. The good thing, though, is that your labels can be as descriptive as you need them to be. If the visitor is male, a member, and a big spender, just label him as such. Remember, the __utmSetVar function creates a cookie, and you can access cookies very easily with JavaScript. You have a lot of options available to you (and I’m particularly fond of tracking exact AdWords search queries, myself).

Now, once you’ve labeled your visitors, you can drill down in Google Analytics to see how they’re performing. Check the Visitors > User Defined report to see traffic for all of your segments. You can also drill down from most reports and segment by User Defined to see, for instance, how many AdWords visitors were also members, or how many New Visitors were big spenders.

As you can see, the opportunities for fantastic segmentation are many. Give it some deep thought and let us know how you’d like to segment your data in the comments below.