Nicole

Understanding the GA Tracking Custom Variables

Est. Reading Time: 3 minutes

School may be out for the summer, but it is back to the basics this week for our Beacon blog!  Since many of our customers are unfamiliar with all of the tracking capabilities Google Analytics provides, I thought it would be a good idea to differentiate the tracking custom variable options.

Custom variables are small tags you can put into your GA tracking codes that help you identify and define additional segments within your current website visitors you already review with GA.  This will allow you to get a closer look how certain, more specific groups of visitors are migrating through your website.    There are three custom variables you can define.  A page variable lets you set it at an event or page view.  A Session variable lasts each time the visitors is on your website.  And lastly, a visitor variable lets you watch that particular computer or phone over time. When creating your custom scripts to track your custom variables, you need to define the four key parameters of index, name, value, and opt_scope like this _setCustomVar (index, name, value, opt_scope).  Below is the explanation that Google provides for these specifics:

  • index—The slot for the custom variable. Required. This is a number whose value can range from 15, 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.

These variables allow you to see more in depth, but they also limit your scope of visitor engagement.  Let’s say you have a shoelace website, and you have been noticing that a lot of your customers are adding items to their cart, but the actual revenue numbers after the sales have been complete do not match the amount in the initial cart baskets.  We can use logic to figure out that people are removing items from their cart before checking out.  By placing a session level custom variable in the tracking code, you can then have the ability to know (not guess!) the number of sessions where your website visitors removed an item from their carts and learn from their session trends how they are making their decisions.