Using Multiple Custom Variables in Google Analytics
Multiple custom variables are a new feature in Google Analytics. Used wisely, they can answer a plethora (yes, a plethora!) of questions that you could never get at before.
We've made a short list of use cases for custom variables. Some of them only apply to certain kinds of websites. The idea, though, is to give you ideas and spur your imagination. Your site already interacts with your visitors in intelligent ways. Use custom variables to bring some of that intelligence into your reporting.
Check Whether a Slot is Being Used
Before going into use cases, be aware that you can test whether a custom variable has already been set. This only applies to visitor-scope variables because they are stored in the cookie and available to any page after being set.
The code for this is
_getCustomVar(index), where "index" is the slot number you want to check.
Custom Variable Use Cases
Try some of these use cases on for size. Most of them require custom coding to pass the appropriate value to GA. That custom coding will depend almost entirely on how your site is set up and how information is stored.
IMPORTANT: Anytime a custom variable is set, it must be followed by a
_pageTracker() or a
_eventTracker() call on the same page, or the variable won't be stored. How to create custom variables.
First Traffic Source
When a visitor returns to your site, Google Analytics overwrites the previous traffic source with the most recent one. However, you can use custom variables to keep tabs on that first traffic source. You could copy the value from the __utmz cookie, just hold onto the referring URL or use some other method to record this. Whatever you choose to record, set the value in a visitor-scoped variable after checking whether that slot is unused.
Use page-level variables to track which categories on your site are viewed most frequently or in conjunction with which other categories. Set the page category as a variable on every page. If you have an ecommerce site, you could see which categories of products are viewed and compare that with which categories are actually purchased.
Visitors Who Share Articles
If you have social media links on your pages, you can track visitors who share your pages to see how their visits differ from other users. Set a visitor-level variable when they click the social media button. This will allow you to see their visits going forward and determine what variables differentiate them.
Visitors Who Fill Out Forms
Set a visitor-level variable when a form is submitted to keep tabs on future visits from visitors who filled out your contact form or a newsletter signup.
Visitors Who Purchase
When a transaction is completed, set a visitor-level variable. This permits you to measure customer loyalty, and also to compare buying customers to every other visitor. If you can tell what sets them apart, you may be able to increase your conversion rate.
Visitors Who Comment
These are visitors who are engaged with your site. If your page prompted a comment from a visitor, tag them with a visitor-level variable. See what else they tend to do on your site. Or just set a visit-level variable to determine what about that particular visit motivated them to speak up.
Visits Where a Widget is Used
If you have tools or widgets on your site, you can track whether a visitor interacted with it. Set a visit- or visitor-level variable when they click on it. If the widget is sourced from a third-party, place it in a div and call the variable when they first click on the div.
Google Website Optimizer Experiments
If you are doing A/B or multivariate testing on your site, recording which variation a visitor sees can be very helpful. Google Website Optimizer, for example, only keeps track of which variation has a high conversion rate. Within GA, however, you can compare the site usage of visitors for each variation to see whether a certain variation affects anything besides conversions.
Individual User Click-Paths
It is against GA terms of service to store personally identifiable information in GA. However, if you want to see individual user click-paths and other user-level information, you could store a timestamp or a random number as a visitor-level variable when the visitor first comes to the site.
If your site has a compilation of articles by different authors, you can track which author's articles are viewed most frequently. Set a page-level variable identifying the author on each page. This would also allow you to determine whether some authors' works lead to higher conversions.
These are all just a glimpse of what you can use custom variables to track. Are there informative uses you have found that we haven't mentioned here? Share them in the comments below.