Custom Variables in Google Analytics

Custom variables allow you to get more details and tailored results Google Analytics, allowing you to define additional segments to apply to your visitors other than the ones already provided by Analytics.

Custom variables are taught as part of our Advanced Google Analytics Training course. If you are new to Analytics and think custom variables are a bit out of your depth then our beginners’ Google Analytics course may be better suited to your needs. Many of our delegates benefit for attending both the courses in tandem to get a complete picture of how to use Analytics and what it can do for their marketing campaigns.

We also offer our Google Analytics courses as part of an SEO package. Books with your choice of SEO, Social Media, Content Marketing, WordPress and Email Marketing courses to create your own custom 5 day training package and save over £500.

What is interesting to Google Analytics specialists is that Custom Variables allow you to set session level segments, which will stick to the visitor while they are active on the site, and page level segments, which correspond to pageviews and events on the site.

This allows you to get much more detailed with the information you’re gathering and storing in the custom variable. For example, you could separate different sections of the site by using the page level scope, or you could track if a visitor has completed a particular action during their session with the session level scope.

google-analytics-custo<code>m-variablesThe different levels of interaction that can be used to find out more about your users behaviour are:

  1. The Visitor; such as the browser or mobile phone operated by a person.
  2. The Session; what happens during the period of time during which the visitor is active on the site.
  3. The Page; activity on a page like a click on a movie button or an add to a shopping cart

Examples of when custom variables would be useful include:

  1. Monitoring the actions of logged in users against logged out users
  2. Monitoring the activity of different membership levels (paid, free, advanced etc.)
  3. Categorising content by topic
  4. Comparing new and existing users – which products did the look and how did they use the site.

Limitations of custom variables:

  • There are only 5 slots available to contain custom variables
  • A visitor takes up one slot forever
  • A session takes up another slot for the time spent on site
  • A page takes up slots page by page. The slot empties after a pageview.

To add custom variables you simply need to add some a new line to your existing GA tracking code.

var_gaq = _gaq | | [];
_gaq.push(['_setaccount','UA-xxxxxxxx-x']);
_gaq.push(['._setCustomVar,INDEX, NAME, VALUE, OPT_SCOPE']);
gaq.push(['_trackPageview']);

Those parameters are set as followed:

  • Index (required) - Determines a custom variable slot. 5 slots are available, numbered 1-5. Single variables should be placed in single slots.
  • Name (required) - the name of the variable. this will appear in your Google Analytics reports when viewing custom variables.
  • Value (optional) - the value of the variable paired with name. For example, if the Name was ‘User-type’ then the value could be ‘regular-user;
  • Opt_Scope (optional) - a level within which a custom variable functions. You can assign the custom variable to three levels; 1 (visitor level), 2 (session-level) and 3 (page-level). If you leave this clear then Analytics will use the default level 3.

Here’s an example of custom variables in Google Analytics given by our trainer Nikki at BrightonSEO.

Similar posts you may like

Tags

,

Share This Post

2 Responses to “Custom Variables in Google Analytics”

avangelist says:

disappointingly this barely got touched on during the session I attended. nice to see this has been added but would have been great from the start

Craig Charley says:

Hi avangelist,

Custom variables are still touched on relatively lightly on the course because they don’t apply to all users. Often the coverage depends on the group as we try to teach the most relevant material to our delegates. We do also offer tailored courses if there are particular elements you wish to concentrate on. As I’m sure you noticed we do cover a lot in the one day!

Thanks for your feedback.

Leave a Reply

 
Request a callback

Follow Silicon Beach Training

Sign Up For Our Newsletter

Exclusive offers, free resources and the latest tech & business news

Home | Sitemap | Print |