• Home
  • Google Analytics
    • Customizations
    • For Ecommerce
  • Speaking
  • About
    • About Me
    • Contact Me
    • Disclaimer and Privacy Policy

Analytics Talk

Digital Analytics for Business

You are here: Home / Uncategorized / Custom Segmentation with Google Analytics

Custom Segmentation with Google Analytics

Posted: July 25, 2006 9 Comments

Last week wrote a piece about using custom segments to exclude yourself from Google Analytics tracking. I didn’t stop to think that some folks may not know what custom segmentation is and how it is implemented with Google Analytics. So today I’ll cover how to setup and use custom segmentation with Google Analytics.

Segmentation of data involves slicing the data based on some visitor characteristic. A very common data segment is new and returning visitors. This means that we can look at the website 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 pre-defined segments that you can find in the Marketing Optimization > Visitor Segment Performance reports.

In addition to these standard segments, you can define your own custom segment. This means you can divide your traffic into various groups, as defined by you, and then observe how those groups interact with your marketing activities and your website.

If you need more information about segmentation, or why you should do it, you can or you can read an article on ClickZ. There’s a bunch of them.

So, how do we add a visitor to a custom segment with Google Analytics? We use a JavaScript function to set a special cookie on their machine. The function is named __utmSetVar(’v’) and the cookie is named __utmv. We can call this function any where JavaScript can be called. When you use this function replace ‘v’ with some value. This is the value that will be stored in the cookie and will be visible in your reports. Here’s an example.

Let’s say we have a contact form on our site and we ask the visitor to specify their gender. There is a drop down box with the different responses. We can call the the __utmSetVar() function when the value in the drop down box changes. This will set the user-chosen value as a custom segment. After the segment has been set all of the visitor’s activites will be ‘bucketed’ into that segment.

User-Defined ReportThere are a number of ways to view how your custom segments perform. The easiest way is using the Marketing Optimization > Visitor Segment Performace > User-Defined report. This shows the visits, average page views per visit, and goal conversion rate for your custom segments.

Cross SegmentationYou can also cross segment many Google Analytics reports based on your custom segemtns. To do this click on the red chevron at the left side of a report (like the Top Content report). Then choose Cross Segment Performance and User Defined. GA will segment that line item based on your custom segments.

There is one major limitation to the Cross Segmentation functionality. You can only set one custom segment cookie at a time, therefore you can only set one custom segment, per visitor, at a time. Luckily this is pretty easy to get around. Recently, I wanted to track the conversion rate for certain genders and age groups. So I wrote some custom JavaScript that takes the gender data and age data from a form, combines it into a single string, and then sets the custom segment cookie. When the __utmSetVar() function is called it looks like this:

__utmSetVar('male:25-35')

‘male:25-35’ would be the value stored for a ‘male’ in the age group of ’25 to 35′. This value dynamically changes based on the data the user enters into the form.

That’s about it. Questions? Comments? Just want to say hi? Leave a comment below.

Filed Under: Uncategorized Tagged With: google-analytics, segmentation, setup, Web Analytics

Comments

  1. moshe weitzman says

    August 9, 2006 at 1:21 pm

    where in google analytics to you parse that combined string so you can see reports on gender alone or age range alone?

    Reply
  2. Justin says

    August 9, 2006 at 3:20 pm

    Thanks! I *knew* there had to be a way to pass more info to Urchin/GA, but I was having troubles finding the technique until I found your site in a google search. For me, I’m tracking an application with its own authentication system (NOT HTTP auth) and I’d like to be able to segment based on user id. This seems like just the thing.

    Thanks again,
    Justin

    Reply
  3. Justin says

    August 15, 2006 at 11:56 pm

    Hi Moshe,

    You really can’t parse the custom segment variable apart once it’s set. What you can do is use the in-report filter to filter your results. Or you could create profile filters based on the custom segment value.

    So, if you had a custom segment that looked like this:

    male:18-35

    and you wanted a profile based on that information, you r profile filter would be an include filter with the regular expression 18-35.

    Hope That helps,

    Justin

    Reply
  4. Mike says

    September 12, 2006 at 1:56 pm

    Thanks for the great tutorial, I’ve now added integrated support for segmentation in to our Drupal Google Analytics module available from http://drupal.org/project/google_analytics

    Reply
  5. Rasmus says

    January 21, 2008 at 4:45 am

    Is it possible to unset the user defined value (for instance when a visitor logs out)?

    Reply
  6. Justin Cutroni says

    January 21, 2008 at 9:18 pm

    Hi Rasmus,

    Great question. To unset a custom segment you need to delete the _utmv cookie. This can be done with some server level code or with some custom JavaScript.

    Thanks for the question,

    Justin

    Reply
  7. Yesak says

    March 12, 2008 at 5:59 am

    Simple but efficient :)
    i also segment my data with filters
    so i can get more segment for one customer
    For exemple i can get the trendings of the males 25-35 of london, and compare them to those of paris
    :)

    Reply
  8. Traian says

    November 28, 2008 at 4:38 pm

    Hi Justin,

    Segmentation was a missing feature of Google Analytics. All other enterprise analytics tool were offering this, but now Google is giving it free. You can dissect data much easier (segmentation was possible even before in GA, with custom filters and profiles as you mentioned, but now it is much easier). I am planning to create a series for segments idea. The first segment we have described on Google Analytics Segmentation page is called keywords with conversions. Please have a look.

    Feel free to visit our blog and if you have any ideas on what segments could be useful, leave a comment and we will try to write a post on that one.

    Reply

Trackbacks

  1. Business Logic - Business Help » Blog Archive » Great Tutorial for very Advance Google Analytics says:
    September 9, 2006 at 5:24 pm

    […] P.S. – This too is an extra-great tutorial: http://www.epikone.com/blog/2006/07/25/custom-segmentation-with-google-analytics/ […]

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

My Books

Google Analytics by Justin Cutroni
Learn More on Amazon.com

Performance Marketing co-authored by Justin Cutroni
Learn More on Amazon.com

Recent Posts

  • Understanding the Google Analytics Cohort Report
  • Using Offline and Online data to drive Google Analytics Remarketing
  • Understanding Cross Device Measurement and the User-ID
  • Universal Analytics: Now out of beta!
  • Advanced Content Tracking with Universal Analytics

Categories

  • About Google Analytics (25)
  • Analysis (52)
  • Analytics Strategy (3)
  • Campaign Tracking (14)
  • Ecommerce (8)
  • Event Tracking (10)
  • Remarketing (2)
  • Reporting (10)
  • Resources (7)
  • Tag Management (5)
  • Tips (25)
  • Tracking (52)
  • Uncategorized (64)
  • Universal Analytics (9)
  • Web Analytics (15)

Copyright © 2023 ·News Pro Theme · Genesis Framework by StudioPress · WordPress