Growing a business is an endless cycle of experiments. You get an idea about why some part of your business is going the way it is, you tweak things a bit to test your idea, and then you review the results. For a web based business like Think Vitamin Membership, Google Analytics is an awesome way to collect information while experimenting and study what’s going on with your web app.
For the longest time I thought that Google Analytics was something that you just add to your site and review from time to time. I’ve learned, though, that tweaking Analytics can give some terrific data that wouldn’t be available by using their default setup. This week we implemented some new tweaks that we’ve made to our analytics setup that might be useful for others, so we figured we’d share them.
Custom Variables and Advanced Segments
One of the biggest questions that we weren’t able to answer with Analytics before this week was what the traffic breakdown between members and non-members was. You can look at new visits and assume that they’re non-members, but that’s a pretty big assumption. You can also assume that members only pages are only members, but that still leaves a lot of traffic up to interpretation. To solve the problem of understanding the split between members and non-members we’re employing Custom Variables.
_gaq.push(['_setCustomVar', slot, name, value, scope]);
_gaq.push method as pushing commands to Google. It takes an array, and the first element in that array is always the name of the command to send. The following elements in the array are the arguments for that command. The arguments for the _setCustomVar are:
- slot – An integer between 1 and 5. The purpose for the slot number will make more sense when we look at analyzing custom variable data.
- name – A string containing the name for the custom variable
- value – A string containing the value for the custom variable
- scope – An integer for scope for the custom variable.
The scope can have one of the following values:
- 1 – Visitor scope. This variable lasts as long as the visitor’s cookie is present
- 2 – Session scope. This variable lasts as long as the current visit lasts in analytics
- 3 – Page scope. This variable is only in effect for the current pageview
In our case, we used the following code:
_gaq.push(['_setCustomVar', 1, 'Member?', 'Yes', 1]);
This code sets a new custom visitor variable named “Member?” with a value of “Yes” into slot 1. In our page we wrapped this code in a conditional so that it only appears in each page if a visitor is logged in.
Initially we also included code that set the variable to “No” if a visitor wasn’t logged in, but realized that if a user logged out the value for the variable would be changed from “Yes” to “No”, so we wouldn’t remember that the user actually was a member. In our case we’d rather remember that a visitor was a member even if they log out, so we got rid of that bit of code that set the variable to “No” when a user wasn’t logged in.
So we’ve got our variable set up. What do we do with it now? That’s where Advanced Segments come into play. To set up an Advanced Segment, log in to Google Analytics and navigate to the profile that you’ve added your custom variable to. In the sidebar, under My Customizations, click on the Advanced Segments link to get to the Manage Advanced Segments page. Once you’re there, click on “Create new custom segment” to build your advanced segment. The tool Google created to design advanced segments is pretty neat – it lets you drag metrics from the list on the left to build the logic for your segment. Here’s what my segment for Members looks like:
Notice how I’m using the “Custom Variable (Key 1)” metric. That maps to the first variable slot that we used when we set the variable. Here’s my segment for non-members, which just checks that slot 1 isn’t set to the “Member?” variable:
Now that we have our segments set up, we can select one or more of them from the segment dropdown on the top right side of almost every page in Analytics to focus on those segments.
_gaq.push(['_trackEvent', category, action, label, value]);
- category – A string representing the category of the event
- action – A string representing the type of interaction that occurred
- label – (Optional) A string representing an additional layer of detail about the action
- value – (Optional) A integer value relating to the action
_gaq.push(['_trackEvent', 'Video', 'Begin', videoName]);
You can review the results of your events in Analytics by going to Content, Event Tracking in the sidebar. The views for Events let you drill down into each event action to see the list of labels and values for that action. In our case that means that we can drill into the “Begin” event to see exactly what videos were watched and how many times they were watched.
One last feature of our site that I was interested in getting more information about was search. We allow users to search for videos, but we haven’t been tracking those searches at all. Setting up search tracking in Analytics usually doesn’t require any changes to your site’s code. All you have to do is go to the settings for your site’s profile in Analytics, enable Site Search, and enter the query parameters that you use for search terms on your search forms. On our site we always represent a search term with a query parameter named
In the Analytics dashboard you can go to Content, Site Search to review your site’s search data. Google includes information on how many searches were performed, what terms were searched for, and what pages users went to as a result of the search.
Well, now that we’ve tuned our Google Analytics settings we’ve got to wait a bit and then we’ll start making tweaks to our app as a result. I’m hoping that segmenting our members and non-members will tell us more about what topics non-members are interested in and also help us figure out the best ways to get users to our sign up page. The video events and search statistics should give us interesting information about how we’ll we’re helping people find the videos they want to watch. Once we’ve gathered more data and made some changes, we’ll probably circle back and fine tune what data we’re collecting with even more custom variables and events. It really is a never ending cycle.
Do you have any tricks that you’re using with Google Analytics? We’d love to hear about them in the comments!
Comments are closed.
Front End Web Design
iOS Development with Swift
Python Web Development
Each is designed by our faculty of tech professionals to guide even a coding beginner to becoming a job-ready software developer armed with a professional portfolio of real-world projects. Try one out today with our free seven-day trial, and see if software development is for you.