Articles written in February, 2012

In Part I of this series we spoke about session level variables. There are two additional types of Custom Variables available for you to use Visitor Level and Page Level. In this post we are going to look at Page Level variables.

A Page Level variable is the activity of the user; which can be a pageview or an event, such as a pdf download or a video view.

One way of using page level variables is to track which areas or categories of your site that visitors are going to. We will use the example of a clothing company that has divided up their products into three areas: Long-Sleeve Shirts, T-Shirts and Dress Shirts.

The clothing company is thinking of having a sale, but they want to determine which areas or categories of their site, not just which pages, are driving the most traffic. If you look at the example, under clothing, there are three types of shirts listed; these three areas will be the “sections” of the site that will use the page level custom variable.

When labeling variable parameters, the naming convention is your choice. I chose “sections” for the name variable in these examples.You could use any naming convention, but a good rule of thumb is to keep them short and concise.

Your script will use the basic method for creating a custom variable as follows:
_setCustomVar(index, name, value, opt_scope)

The index, name and value parameters are required while the opt_scope parameter is optional, but it 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). If left undefined, the custom variable scope defaults to page-level interaction.

Using the code example below, the clothing company would use the session parameter to set which areas or categories of their site they would like to track. They would then place the coding on each page that displays Long-Sleeve Shirts, T-Shirts or Dress Shirts.
Example of the Custom Variable coding structure:
_gaq.push([‘_setCustomVar’,
1, // This custom var is set to slot #1. Required parameter.
‘Section’, // The top-level name for your online content categories. Required parameter.
‘T-Shirts’, // Sets the value of “Section” to “T-Shirts” for this particular aricle. Required parameter.
3 // Sets the scope to page-level. Optional parameter.
]);

What is a custom variable and when do I use it? Custom variables are tags that you insert into your tracking code that allows you to be able to filter your Google Analytics tracking down to certain segments of your site. You will be able to define those sections and segment your visitors to get a better understanding of how they use your site. Running custom variables will allow you to gather data that Google Analytics does not provide in their standard set of reports.

We are going to look at custom variables in three parts. This post, Part I is on Session-Level variables or the period of time during which the visitor is active on the site. To track the actions of the visitor during their session, the actions are stored in a cookie which is deleted when the session cookie expires.

The most common use for this custom variable is for logged in members versus anonymous visitors.

As you are able to set up an assortment of custom variables to track user activity for your site, you’ll usually create your own JavaScript utilities to manage them. Your script will use the basic method for creating a custom variable as follows:

_setCustomVar(index, name, value, opt_scope)

This method accepts four parameters:

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.

When reviewing the Google Analytics over-time graph and screening website traffic spikes on a daily, weekly or monthly basis, the lines and graphs will not explain to you why the traffic is moving in either direction. For example, today you might have had 6,000 site views, but tomorrow you might receive over 10,000 site views. Tomorrow will be the day that your new marketing goes into effect and an email blast will be sent out driving traffic to your new monthly promotion. This is a perfect example of where Annotations would be used.

Any user with access to your Google Analytics profile can leave notes right on the
over-time graph. Instead of looking at a raw set of data and numbers an Annotation will give you a better sense of why your traffic increased or decreased.

These notes can be as simple or as detailed as you make them. Annotations can become your sticky notes for all information pertaining to your marketing endeavors or website issues. To create an Annotation, you can either click on the day you want to annotate or click on the down arrow on the bottom of the over-time graph and click on on the right side of the tool bar.

For instance, your web server might have gone down for six hours; it would be to your benefit to make an Annotation to that fact. Otherwise you would see a downward traffic spike and not know the root cause.

Beyond marking traffic spikes, Annotations can be used to mark changes to your website design or layout, mark the start and end of any campaign or notes or change of keywords.