Google Analytics Custom Variables, Part I: Why?

April 15, 2010 | Jonathan Weber

Google Analytics recently introduced custom variables as a way to keep track of information about your visitors beyond the stuff that Google Analytics already knows about them.

What is a custom variable?

GA already records whether someone is a new or returning visitor, from which country and city they’re browsing, from what campaign or keyword or link they arrived at your site, and more.

crayons

But sometimes you know other information about your visitors that you might want to keep track of in GA as well. Your CRM system might have demographic information about people, for example. (We’ll look at some more examples below.) If you stored this information in Google Analytics, with the use of Advanced Segments you could see whether males between 25-45 with kids were more likely to purchase than females 18-25 with no kids (or whatever).

Didn’t Google Analytics already have this?

Before “custom variables”, there was the “user-defined segment”. Notice the singular “segment” vs. plural “variables”. You used to have to do all sorts of contortions to store more than one value with this feature. Now, with custom variables, you can easily store multiple values.

(Please note: If you’re using the old user-defined segment, Google hasn’t announced that it will go away any time soon. But clearly custom variables are the way of the future.)

Scopes and how to use them

We’re not going to talk about the technical details of custom variables (we’ll save that for a later post). But I do want to talk about one important property that they have called “scope”.

The scope basically indicates to what level of detail in Google Analytics the variable should apply. The scope can be visitor, session, or pageview.

Visitor level variables are much like the old user-defined segment. They get stored in a cookie for the visitor and apply every time that visitor returns to the site. This scope is best used for properties that are intrinsic to the visitor, or at least semi-permanent. You might want to record such things as:

  • Demographic information: age, gender, income, family, occupation, etc.
  • Customer information: “member” or “subscriber” or “gold club”
  • Original source information: how did they originally find out about us

Session level variables apply only to the single session (visit) during which they are recorded. They’re great for particular behaviors that occur during a visit, such as:

  • Added an item to the shopping cart.
  • Viewed a particular section of the site.

Pageview level variable apply only to the single pageview during which they are recorded, potentially including such things as:

  • Marked a page as a “favorite”.
  • Notified a friend about an article.
  • Viewed another tab within a page.

(Note that using pageview-level variables potentially have some overlap with event tracking. It’s up to you which model works better for particular actions on your site.)

More about custom variables

Now that you have some idea about why you might want to use custom variables, we’ll talk about how to actually make use of them in later blog posts. Check back soon for another post in this series.