One of the things that I like most about Google Analytics is that it can be as simple or as complex as you like. Out of the box it's very easy to use. Without much experience, you can quickly see the basics, like the amount of traffic you receive as well as the medium and source of traffic. But: We have a problem. The problem is that that's where most people stop. Too many people are making bad decisions by looking at Google Analytics data from a 30,000-foot view. With a little more work you can reveal some quick insights that could reveal easy CRO wins. To demonstrate how, I'll cover a couple of advanced segments that I like to use and explain how to set each of them up using custom variables, event tracking, and filters. Advanced segments are a huge area; you can make almost unlimited variations, so I've just picked a few that will hopefully inspire you to create some advanced segments of your own (I'd love to hear about them in the comments).
Attribution
Before doing anything, it's important to have a data set that you can trust, and that starts with proper attribution. If you haven't already read Annie Cushing's blog post "Take Credit Where Credit's Due," I highly recommend it, as it goes into a lot more detail on attribution. The full video is also available on the Distilled store.
Attribution starts with ensuring the correct mediums and sources are getting credit for the sales and actions they generate. The opposite is also true: You don't want good channels getting diluted by cross-contamination of bad channels. By default, Google has the basics covered, as shown below.
But for some websites, that "(none)" category can make up a significant portion of your traffic. Referral traffic isn't great either, as it doesn't tell you about the "why" part. Was it a press release that drove a lot of that traffic? Or was it email?
Thankfully, we have the ability to do campaign tracking using URL parameters that can help make these mediums more useful. The medium that's usually impacted by this the most is email. By default, Google groups email into the referral bucket.
To avoid this, you can create a new "email" medium by tagging all links in emails with URL parameters. Explaining tagging in detail is out of the scope of this post, so I'm going to assume you know how to do it. If you don't, you can read up on how to track emails in this post.
#Protip: The most common objection people have to using URL tagging is that it creates ugly URLs for users. Here's a solution.
Let's assume I want to track the people that visit the Annie Cushing video I recommended. The URL might look something like this:
https://www.distilled.net/store/sl-bos-2013-cushing/?utm_source=moz.com&utm_medium=referral&utm_campaign=annie+cushing+video
Pretty horrible. But your users never need to see it, thanks to some HTML5 goodness. You put the link in some anchor text, such as click here. Then on that landing page you would add something like this:
_gaq.push(function() { window.history.pushState('','', 'some-page'); });
This means after the Google Analytics code has fired and collected all the attribution data from the horrible-looking parameters, the URL will be changed to whatever you set in the quotes. In this case it would change the URL to:
https://www.distilled.net/store/sl-bos-2013-cushing/some-page
But it could be anything you like. See this blog post from Rob Ousbey on the topic.
The downside to this is if people then share or link to that page it will 404, so if you just want to chop off the parameters, just replace the "some page" part with a ‘#'. There's probably a better way to do this so that there's no #, but I'm not a developer so I settle for "good enough" on this kind of thing.
So, to be clear, the action here is to get all your attribution set up correctly. For lots of details on how to do that, see Annie's post. Doing so will allow you to do some proper CPA analysis for the various channels you use.
Tracking form errors
Regardless of how easy you make your checkout process, there will always be people that struggle with the forms, so we want to know how and where these people are having problems. If we manage that, we make more sales. There are solutions such as Clicktale that allow you to analyse the forms on your site, but they don't allow you to tie that together with other metrics from your GA, such as conversion rates. To do this, I want to use Google Analytics event tracking to create an event any time someone fails to do something correctly on any of the fields in the form. Events use the following format:
_gaq.push(['_trackEvent', action, opt_label, opt_value, opt_noninteraction)
In my case I want to set:
- Category = Form Error
- Action = Submit
- Opt_label = A way to identify the field that caused the error, for example "Phone number" or "Post Code"
You then need to set this to fire only when there is a validation error on the page. A validation error is that annoying red text that appears when you mess something up on a form. From a technical point of view there are a couple of different ways this can be done, depending whether the form is validated on the client side via JavaScript or on the server side (in which case the page will be reloaded).
Server side
On the HTML that gets sent to the browser when an error occurs, you'll need to add the event tracking to the text that fires next to each of the fields. Doing it this way allows you to not only see users that had problems, but will also let you see specifically what fields people have the most trouble with. You can then slice and dice that data however you like in GA to find other things like browser OS, etc.
Client side
If the validation is being done on the client side using something like JavaScript, the same process needs to be used, but the events will need to be fired by the script that creates the errors.
_gaq.push(['_trackEvent', 'form error', 'submit', 'phone number']);
Tracking email unsubscribers for content analysis
Most email management services will allow you to see stats like open rates, number of people unsubscribing, etc., but they don't give you many insights into why those people unsubscribed — which is what we really need to know. To help get some insights it can be useful to find out which content those people have read the most, as this could potentially let you see what kind of content your audience doesn't like. You could even go as far as looking at authors.
To do this, you'll need an email provider that lets you add some custom code to the unsubscribe page. At Distilled we use MailChimp, which I know has this feature, but I'm not sure about others. You can then use whatever method you like to bucket these users, you could add a custom variable or event tracking to your Google analytics code, like this:
_gaq.push(['_trackEvent', 'email', 'unsubscribed']);
The advantage of events is you can use them with goals, which would allow you to track over time and set up alerts for spikes in unsubscription rates.
Once this is set up, you'll want to create an "unsubscribed" advanced segment in Google Analytics for the event name like that shown below in the example:
Once you have these people in a group, you can start to slice the data however you like to find trends among the people who don't want to be on your list anymore.
Logged in/out
Depending on the type of site you have, it may or may not make sense to create segments based on whether your users are logged in or out. For example, you may have a different checkout process if you're logged in. Wouldn't it be nice if you could see the difference between conversion rates between logged-in and logged-out users? Or compare the behaviors of logged-in users compared to logged-out users? Thankfully, this is pretty easy to do. In fact if you look at the source code of this page, you can see how. Do a search in the source code for "setCustomVar" and you'll see what I mean. You'll see one of a few options but they will all follow a format like this:
This sets a custom variable with "user-type" as "visitor." If you're logged in and a pro member, you might see "Pro." From a CRO perspective, the point in doing this is you can see how different groups of people act on the site and use that information to increase the conversion rate of each group. You'll typically find that logged-out users convert less, as they have extra steps in the process, but you can always optimize the registration process to make it as painless as possible. When possible, I'd always take the Amazon approach and leave people logged in as long as possible, and have their credit card details saved to allow for quick and painless payment.
Also, once you can track people that are logged in, you can create advanced segments for things like "logged in users that added an item to their cart but didn't buy." These are easy pickings; on the server side you can segment by these users and send them an email to remind them that they have items in their shopping cart that they are just one click away from buying.
Find the "whales"
I got this idea from Avinash. You can read the full post here. The idea is that you create a segment of users that typically spend more than the average customer, hence the term "whale." This is also why it's a good idea to have your attribution tracking set up correctly from the start, as you need to know where those whales came from as well as how much they cost to acquire compared to the average customer.
To do this, segment by users that bought more than a certain number of items:
Once you have this data, you can begin to focus on the other data that's available to you, such as the medium and source of those users, and double down on the best channels.
That's all for now, I hope you've found this useful and I'd love to hear some of the custom segments or interesting ways you use Google Analytics in the comments.
Craig, for campaign tracking (attribution) what if you use fragment identifiers in the URLs? Meaning, instead of using the question mark (?) in the query parameters, use the hash (#).
Instead of
https://www.distilled.net/store/sl-bos-2013-cushing/?utm_source=moz.com&utm_medium=referral&utm_campaign=annie+cushing+video
use
https://www.distilled.net/store/sl-bos-2013-cushing/#utm_source=moz.com&utm_medium=referral&utm_campaign=annie+cushing+video
Benefits:
- GA will read the tracking data
- This will allow linking without 404 issues
- Google ignores everything after #, so authority is channeled to the correct URL.
Wouldn't this be a more efficient/easier way to do it?
PS: to track the # you will need to add
pageTracker._setAllowAnchor(true);
to GA tracking code. doc here.
Hey Traian,
Yup that works as well, thanks for sharing.
great post thanks!
These tips are very useful and can help every business. If anyone would listen to them their sales on their websites would surely increase.
Craig--great post! If mozzers are interested in advance analytics, I recommend picking up Avinash's book (that you mentioned in your article) and Brian Clifton's book. Both books are incredible and great reading.
Hi Kevin,
I'm interested in advance analytics, but intimidated. Which book is easier for the novice GA nerd?
Hi Rich, I would start off w/Avinash's book as it's more conceptual (check out his blog at Occam's Razor -- he is the "guru" in this field). Brian's book is practically all technical. However, he does an incredible job in explaining why/how to use Analytics properly and how to gather data properly. Don't be intimidated because both books do a great job of explaining items in a sequential fashion staring from easir to more difficult.
Hi Craig,
Very good post on GA. I would have to agree that GA can be as simple or as complicated, depending on how you use the tool. However, I would prefer to explore GA more and your blog post showed me exactly how you can utilized GA fully.
Hey, I also recommend you to check this article on How to track your rankings with extra tips on Google Analytics. https://www.traffictravis.com/newsletters/0533
Excellent post, Craig! And a very timely reminder that I have some GA work to do. :-)
Super new to all of this beyond the very basics. Thanks Craig, as this sets me up to get started. I'm headed over to read the articles from tho links to get some good understanding of what I've been missing. I do all this for my own small business, and knowing how to track where things are coming from better would be great. I never even know I could track the links from my email signatures.
This is an awesome post. Segmentation to drive marketing initiatives is the simplest process and yet so many companies miss this and lose out on revenue that could be repumped. I've bookmarked this for a forward. Great.
Awesome tracking tips. Thank you.
There are many interesting articles in this blog, this is one of them, I hope to continue learning more things in moz and investigate to complement some details, excellent post
Hey!
Finding the "Whales" is good and important way to segment.Will try it.
Thanks!!!
Hello Craig,
Thank you for the Awesome post!! It is quite difficult to detect the errors for many people and your post is quite useful for all such people. Thanks for showing the deep research and statistics on GA.
Craig@
Great post.. Sales matters a lot and we all wonder to get some effective ways to increase our sales and your post gave some concept to increase the sales.. good work.
Awesome post Craig, Thanks for distributing depth statistics on Google Analytics. Advanced Segmentation is one of the mainly admired and authoritative features in Google Analytics.
I love it.
Nice post Craig. Thank you. Thanks to KevinBudzynski also for linking to Advanced Web Metrics with Google Analytics book. I already have that one and it's very helpful reading
Hey Craig,
I'm a huge fan of advanced segments in Google Analytics! I primarily use them to track and filter our social traffic. I haven't really played with 'Event Tracking' but instead use a onclick="_gaq.push(['_trackPageview', to track onsite clicks.
Check out this article from social examiner advanced segments in Google Analytics: https://www.socialmediaexaminer.com/how-to-track-social-media-traffic-with-google-analytics/
..
Excellent post for the deep insights which Analytics can offer to web master. Heatmaps as offered by Clicktale or others can make significant impact. Add on to it - if the medium source of traffic along with idea of whales is outstanding
However, with degree of engagement comes another important thing - Analyze Landing page optimization. Its also important to know along with how many users are bouncing off the site within 20 secs. Is it that they have come to an off page or the content of the page was irrelevant, search query
May be an insight on this parameter too, can enhance the conversion ration in a much better way for the webmaster
Grete post Craig, Thanks for sharing depth info on GA. it would be also great ideas for conversion focused websites to look at goal funnel. it will give you very clear pictures of your bounce rate for specific pages and then you can investigate reason's for to reduce that bounce rate. I agree with trianNeacsu regarding not creating 404 issues.
Good stuff. It's about time I started experimenting with those GA custom variables.
As for fixing the ugly URLs without making the link not work OR having to use a #, you should be able to get the rewrite to only get rid of everything from the "?utm" and on. So, in your example above, if you could rewrite this:
https://www.distilled.net/store/sl-bos-2013-cushing/?utm_source=moz.com&utm_medium=referral&utm_campaign=annie+cushing+video
to just this:
https://www.distilled.net/store/sl-bos-2013-cushing/
Then everything would be just perfect (I think - exceptions would be sites where other parameters after the question mark affect the script that loads the content, but for most blogs and other places I've seen the utm_source stuff used, that's not an issue).
Interesting post, thank you.
2 Questions:
-1- How do you set-up the CustomVar for logged in & logged out users? Do you do it through if functions?
-2- Furthermore, which product would you recommend, Clicktale or Crazyegg?
Cheers.
Hey Bru,
1 - Just add different custom variables to your logged in users compared to logged out using cookies.
2 - I honestly haven't used Crazyegg much, but from what I can see Clicktale has all of the features of Crazyegg anyway? It looks like Crazyegg has lower pricing though so I guess it depends which features you value the most.
Excellent post! My 5 cents, Moz should implement a Twitter card, so if anyone would share this link, the thumbnail will look better.. Also sharing this link on Linkedin will give a weird image.
Hello Craig,
Thanks for the advanced tracking tips. For many it is very difficult to track errors on form fields, I'll suggest your post to them. The week has started with a great post.
Thanks for this--A good reminder that powerful analytic tools are often under utilized!
It was a wonderful Post.
Helped me in Understanding a lot with Web Tracking and Analytics.