If you are still using setVar to populate a user-defined segment you should be aware that that function has been deprecated. It will still function as is, but any new features or functionality will be introduced using the Set Custom Variable code:

pageTracker._setCustomVar(index, name, value, opt_scope)

The SetVar field used to be the only way to pass a custom value to segment with to Google Analytics. It served as a wildcard, allowing any value to pass into the default user defined field. Google has expanded upon this functionality by creating introducing custom variables and adding the following;

  • 5 Slots for Fields. This allows you to segment by multiple custom field values. If you used to capture an action like “login”, as well as something like newsletter signup, it is now possible to roll these up to determine how many users who logged in signed up for the newsletter.
  • Group by Name – You can now group segment values by name. For example, if before you are collecting hometown values for members, you can now roll them up under the “home town” custom field group to avoid having these values appearing in one giant list.
  • Additional Scopes – Previously, custom variables would only be passed on a pageview. So if a visitor saw a specific custom field value on one page, that value would be related specifically to that page. Google now has included the visitor scope (the value for the custom field will apply to repeat visits as well as the current session) and session scope (the value will apply to the whole session). It is now possible to identify users based on their first action they’ve ever taken on a site, or even the first action in the session.


  • Limits – You can now have up to 5 custom fields generated on one page (before you were limited to one field – the setVar field)

What is the practical use of Custom Variables?

Google Analytics now has the ability to segment by additional metrics determined by the customized implementation. A site that focuses on user behavior for example, will want to collect information such as what the first action of value was that the visitor took. They could also compare this to the most recent action they took. Did users make a purchase first and then sign up for the newsletter? Did they join the forums first, then after discussing the product decide to make a purchase? Understanding where high-value users are is something every website can benefit from.