Next Youngsday








Home / Tech / Business Intelligence / 6 Ways to Leverage Custom Variables

6 Ways to Leverage Custom Variables

Segmentation and filtering are two important concepts that you should leverage when using web analytics tools ( Custom variables (CV) constitute an extra layer of segmentation that you can customize and set according to your analytics needs. For example, you could set a CV in order to know which product is being bought by your customers coming from a specific traffic source. This post aims to introduce Google Analytics’ CVs and various ways to use them.

How to Use Google Analytics Custom Variables?

In Google Analytics, you can define up to 5 CVs and up to 50 CVs on the premium version. Thus, make sure you thoroughly consider which CV to implement and track. The implementation of CVs is done via adding javascript tags to your code. This tag has the following structure:

_gaq.push([“_setCustomVar”, index, name, value, opt_scope]);


index—The slot for the custom variable. Required. This is a number whose value can range from 1 – 5, inclusive. A custom variable should be placed in one slot only and not be re-used across different slots.

name—The name for the custom variable. Required. This is a string that identifies the custom variable and appears in the top-level Custom Variables report of the Analytics reports.

value—The value for the custom variable. Required. This is a string that is paired with a name. You can pair a number of values with a custom variable name. The value appears in the table list of the UI for a selected variable name. Typically, you will have two or more values for a given name. For example, you might define a custom variable name gender and supply male and female as two possible values.

opt_scope—The scope for the custom variable. Optional. As described above, the scope defines the level of user engagement with your site. It is a number whose possible values are 1 (visitor- level), 2 (session-level), or 3 (page-level). When left undefined, the custom variable scope defaults to page-level interaction. [2]

Before defining any CV, make sure to fully understand the analytics tool that you are using, the metrics and dimensions it offers, etc. Then, depending on the nature of your business, define and implement CVs that will help you complement the existing dimensions. For example, if your website is an e-commerce website, you could define the following CVs:

1. Product views: track the e-commerce and onsite metrics of each product. You will gain a strong insight into the visibility that each product is getting and the performance it is achieving

2. Voucher: track the voucher codes that you are distributing via your various online and offline marketing campaigns

3. Payment methods: track the usage of the various payment methods you are offering on your website. The analysis of the payment step will allow you to improve your checkout funnel and, hence, your website’s conversion rate

In addition, if your website is a content website (news, blog, etc.), you could define the following CVs:

1. Authors: measure the content’s performance that your authors are creating. You could decide to work more closely with certain authors in order to increase engagement

2. Categories: track and understand the onsite metrics of each category you are offering on your website

3. Newsletter subscription: track the subscribers to your newsletter and analyze their behavior on your website

Implementing, tracking and analyzing custom variables will allow you to discover and understand hidden spots that your analytics’ tool does not offer by default. Make sure to always customize and personalize the outputs of your analytics’ tool in order to get a stronger insight into your visitors’ behavior on your website.



[1] Cover Image:


Paul Debahy

Leave a Comment

Your email address will not be published. Required fields are marked *


* Copy This Password *

* Type Or Paste Password Here *

Scroll To Top
Sign up for our Newsletter to keep updated for

Enter your email and stay on top of things,

Youngsday on Twitter!
Follow us on Twitter!