Custom Segmentation

Segmentation of data involves dividing the data based on some visitor characteristic. For example, a common segmentation is dividing the data into two groups, new and returning visitors. Grouping the data by new and returning visitors means you can examine your web site traffic and identify what portion is generated from new visitors, what portion is generated from returning visitors, and what those groups did while on the site.

Google Analytics has a number of predefined segments, including:

  • Visitor type (new and returning)

  • Geolocation

  • Language

  • Browser type

  • Computer operating system

In addition to the default segments, you can configure Google Analytics to use a custom segment. This means traffic can be divided into various groups, using a characteristic defined by you, the site owner.

Creating a custom segment involves adding an additional Google Analytics tracking cookie to the user's computer. The cookie, named __utmv, is created using a JavaScript function named __utmSetVar().

__utmSetVar() can be added to a web page anywhere JavaScript can be added. This means that __utmSetVar() can be placed in many HTML attributes such as:

  • onLoad

  • onChange

  • onSubmit

The value passed into the function will be stored in the __utmv cookie. When Google Analytics processes your profile data, it creates a field named User Defined Value and populates it with the value in the __utmv cookie. This field is just like any other field in Google Analytics. You can create filters using this field ...

Get Google Analytics now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.