Do you run a subscription based website? You know the type of site: customers pay you a monthly fee and you give them access to valuable content. I’ve worked with a number of clients with this business model and have noticed that many make a consistent mistake when setting up their analytics package: they fail to segment people who subscribe to the website (i.e. members) from those who do not.
Why is this so important? Here’s an example. The following image shows some real data that is not segmented other than the removal of internal employees:
Now, here are the same metrics with members removed:
Big difference, huh? Just image how this changes all those metrics that are calculated using Visits, like conversion rate, abandonment rate, etc.!
It doesn’t matter what analytics tool you use. If your website has some type of member’s area you need to segment out members to get an accurate view of your website performance and online marketing activities.
The Google Analytics Way
If you’re using Google Analytics the implementation is simple. Use GA’s custom segmentation feature to identify and segment members. Remember, the custom segmentation features uses a JavaScript function, __utmSetVar()
, to set a cookie, named __utmv
, on the visitor’s machine. The cookie is a persistent cookie and lasts for 6 months 2 years. You need to call __utmSetVar()
when a member identifies herself. You can put it on a ‘thanks for logging in’. Here’s a perfectly good implementation of the code:
Remember, the above code snippet should appear AFTER the standard Google Analytics tracking code. The reason is that the __utmSetVar()
function is in the urchin.js
file. So if you try to call __utmSetVar()
before the urchin.js is loaded by the browser then the visitor will receive an error.
Once the cookie has been set on the visitor’s machine you can use the custom segment value to exclude them from a profile. The exclude filter would look something like this:
Any profile that has this filter will only show data for those visitors that are not members thus providing a more accurate view of how effective the website is at converting visitors.
And let’s not forget about the members. You can create a profile that only includes members (the filter settings are almost identical to the filter above, just change the filter type from ‘exclude’ to ‘include’). By creating a profile specifically for members you can focus on their usage of the member’s area. For example, the Top Content report will identify the content that they find most engaging. You could also use some of the loyalty reports to see how often they use the website.
Tip: Tracking Different Subscription Levels
If your membership model has various level, like Gold, Silver and Bronze, you can include this information in the custom segment value. This allows for a more detailed analysis of each membership level. Just modify the value you pass to the __utmSetVar()
function. For example:
or
or
After the custom segment cookie has been set you can create different profiles for each subscription level. Use the filter shown above, just change the value for Filter Field to match one of the values in the code above. Then you can use the profiles to analyze the member data and observe their habits.
Does the __utmSetVar(’member’) code need to be printed throughout the visit of the logged in user (in each page) or only once in the login_success page?
Thanks!
Hi Roy,
Great question. No. you do not need __utmSetVar() on every page. Once that function executes it sets a cookie on the visitor’s machine. The cookie will persist and every action that the visitor performs is attributed to the value in the cookie.
Thanks for reading,
Justin
Will the cookie persist across sessions and remain valid for future visits?
Also, if you want to see activity for both members and non-members, that means you will need to set up two profiles in Google Analytics and include two sets of the Google tracking code on every page, correct?
Nice post my friend.
Welcome back! :)
-Avinash.
I have been experimenting with this approach in pretty much the same context and came to the following conclusion: once a visitor has been identified as part of a segment, it is not possible to change this segment within the visitor’s session.
So let’s say a visitor upgrades its membership from ‘member-bronze’ to ‘member-silver’. To reflect that upgrade, the segment should be changed using __utmSetVar(). From my experience, GA will only show the first assigned segment.
Can you confirm that?
Thank you
Hi Jon,
Yes, the cookie will persist for 6 months.
To see the activities of members and non members you only need one profile. Remember, only the members will have a custom segment value. So the User Defined report will identify customers (who will have a custom segment value of ‘customer’) and non-customers (who will be in a line item named ‘not set’).
Hope that helps.
Justin
Avinash –
Thanks! It’s good to be back. I wish I could say that I was enjoying lots of free time, but I can’t. I’ve got some fun posts coming in the next week. :)
Paul –
The way that GA ‘moves’ a visitor from one segment to another is a bit unique. If a visitor is not assigned to a segment, i.e. they have a value of ‘(no set)’, and then you put them in a segment, then the visitor’s current visit, and all subsequent visits, are moved to the new segment value.
However, if the visitor is already in a segment, and then you change that segment, then the FOLLOWING visit, and all visits after that one, will be moved into the new segment.
I know what you’re thinking, that this is a bit crazy and will ruin the quality of the data. It doesn’t help, but given the state of data quality it’s impact is negligible.
I hope that makes sense.
Justin,
I owe you a HUGE thank you for this post. Just finished in 5 min what i was expecting to spend an hour on.
Hello,
I am curious whether there is a method to set a cookie using Google analytics that tracks PPC visitors up to 90-days?
Hi Bryan,
By default, GA will set a cookie (named __utmz) that tracks all referral information, this includes PPC traffic. For this to work you must tag your PPC links.
The tracking cookie will persist for 6 months. If you would like to change the timeout value you can add the following line to your tracking code:
var _ucto=”7776000″;
That set’s the timeout of the tracking cookies to 90 days and not 6 months.
Hope that helps,
Justin
Justin,
Thanks for the great information on how GA handles segmentation.
I also have an issue where occassionaly I might want to track my users in one segment for part of the visit and in another segment for part of the visit. I understand that if you change the segment it will not start tracking to that segment until the following visit.
My question is how does GA define “following visit”? Does the browser need to be closed or is there a timeout value that GA uses? I’m guessing that after some amount of inactive time (30 minutes?) that GA will consider the next access to the site to be a new visit. Am I close to understanding this correctly?
Hi David,
You’re right on the money. A visit ends when the browser closes or after 30minutes of inactivity.
Thanks for the question and thanks for reading.
Justin
Excellent post, this is exactly the type of information I am looking to learn with Google Analytics. I also just added your feed to my reader. Thanks!
Hi Justin,
“If your membership model has various level (…) just modify the value you pass to the _utmSetVar() function”
How do I “just” do that? Where do I define which value will be passed to the function?
Thanks.
Hi Daniel,
You need to add some server level code that puts the membership level in the utmSetVar() function. Usually the membership level is stored in the database. When you check the visitor’s credentials in the DB you can also extract the membership level.
Hope that helps and thanks for reading!
Justin
Hey Justin. Great post, I’m working on an implementation and this is great info.
So what if you have a drop down with like 20 values such as ‘Industry’. Each would be a unique value. So I’m guessing the only way to handle this would be to create 20 profiles?!? There has to be an easier way right?
Hi Jim,
If your drop down has 20 items, then you’ll create 20 custom segments. You should see each of your segments in the User Defined report.
This post was to really show how to separate smaller segments, like a group of members, from the larger population.
If you have 20 custom segments you can create a profile for each, but you may want to wait until you start to develop some questions on their behavior.
The one thing to keep in mind is you can never create a profile for historical data. So, if you have any questions that you want to answer about a particular segment you may want to create that profile up front and then delete when it is deemed useless.
Thanks for the question,
Justin
Justin, thanks for such a great resource. This article was a huge time saver in helping to implement GA.
We have a site with registered users and many different segments. We were planning on creating one long string with user type, account level, gender, age, sport, discipline then parsing with different profiles to create our desired segments. I Have a couple questions regarding problems this may cause …
1) Is there a character limit on the length of the variable? An example might look like Athlete : Premium : Male : 18 : Skateboard : Halfpipe
2) Is there a limit to the number of entries in the User Defined Value table? The number of values we have will presumably equal the total number of members we have (which is currently about 350k and growing fast).
Thanks so much!
RJ
Hi RJ,
I’m not sure if there is a limit on the number of characters. That’s a great question. But I would suggest keeping it relatively short so it’s easy to manage the data.
As for a limit to the amount of data that GA will collect; I know that it will only collect 50k unique URLs per day due to a database limit. I would assume that the same limit also applies to the number of unique custom segments.
Glad you found the post helpful,
Justin
So using RJ’s solution, one could track many segments and create the right filter (or custom segmentation) to report on one or more custom segmentation (like what Athlete AND male) are doing on your site?
Thanks
Hey Martin,
I haven’t tried it, but it should work.
Thanks RJ for posting that idea.
Justin
Is there any harm in including the var on every page? Or must you only include it on the first page of the visit?
Hi David,
You can put it on every page, just make sure it’s setting the same value.
Thanks for the question,
Justin
What happens if someone upgrades midway through their session?
ie:
1. comes to site
2. logs in (var = usertype1)
3. user upgrades (var = usertype2)
David,
In the scenario that you describe, and assuming that the visitor does not have a custom segment value,, the current visit will get attributed to the first value (usertype1) and the following visit will be recorded as usertype2.
Your best bet is to set the custom segment once and not change it.
Hope that helps.
Justin
Thanks to RJ and Justin for the previous posts – they were helpful.
We are interested in using GA to track the usage of our web app (in ASP) by customers (i.e. companies) and the individual end users of our customers. The number of customers is currently under 10, and the total number of end users is currently under 20 – but we hope to grow to 25 customers, and 250 end users within a couple years. ;->
We want to measure activity at a customer level (therefore an aggregate of all the end users of a given customer), as well as at a single end user level.
Basically, we are interested in segmenting based on company ID and user ID.
Would you suggest advanced segmentation to achieve the above?
E.g.
“Customer 1 : Joe Pilgrim”
“Customer 1: Sara Jones”
“Customer 1: Sam Smith”
“Customer 2: Wally Wales”
“Customer 2: Jim Bryant”
Giovanni,
Sure, you can do it that way. But remember, it is against the GA TOS to track personally identifiable information in Google Analytics. Google will come after you if they find info in your account.
Thanks for the question,
Justin
Can I use the utmSetVar to “group” secitons together?
ie, I have pages about cars, trucks, and boats. And I want to see how many more pages are viewed about trucks than cars or vice versa.
I have pages about trucks, then wheels of trucks, and cabs of trucks, and I want to group those all into “trucks”.
Any advice would be great, thank you!
Hi Jonathan,
As luck would have it, there is a new feature in Google Analytics call Custom Variables which will do exactly what you’re asking. The feature is VERY new, and we’re still feeling it out, but you should focus on Custom Variables not Custom Segments.
Thanks for the comment,
Justin
We have a subscription based site where most of our content is only accessible to logged-in members. Based on your post we would add the code to all of our locked member only pages and set the filter.
Is that correct?
Hi Kevin,
Yes, that would work. That would effectively segment those viewing your member content.
I should note that Google announced a new feature today called Custom Variables. This is an evolution of custom segmentation and will provide you with a lot more flexibility.
Justin
Google’s Help site on this topic says the cookie persists for 2 years, whereas you say it persists for 6 months, which is true?
“When custom visitor segmentation is working correctly on your site, a visitor cookie called __utmv is set to the selected value on the visitor’s browser. This first-party cookie persists for 2 years unless it is over-written with a new value. ”
http://code.google.com/apis/analytics/docs/tracking/gaTrackingVisitorSegments.html
@Michael: Thanks for the heads up. The V cookie did change when they updated custom variables. I’ve updated the post. Thanks!