Friday, 8 April 2011

Custom Variables in Google Analytics

Custom variables are name-value pair tags that you can insert in your tracking code in order to refine Google Analytics tracking. With custom variables, you can define additional segments to apply to your visitors other than the ones already provided by Analytics.

You'll get the most out of custom variables if you understand the basic visitor interaction model used in Google Analytics. In this model, the visitor interacts with your content over a period of time, and the engagement with your site is broken down into a hierarchy.


The diagram illustrates this model for a single visitor to your site, where each block represents the number of user sessions and interactions from that particular user.

Each level in this model is defined as follows:

* Visitor—the client that visits the site, such as the browser or mobile phone operated by a person.

* Session—the period of time during which the visitor is active on the site.

* Page—activity on the user's behalf which sends a GIF request to the Analytics servers. This is typically characterized by a pageview, but it can include:

o a pageview
o an event (e.g. click on "Add To Cart" button)


Syntax

_setCustomVar(index, name, value, opt_scope)

Points to Remember


  1. All parameteres are required except the last one.
  2. The sum of all your custom varaiables cannot exceed 5 in any given request.
  3. The length of the string used for the name and the length of the string used for the value must not exceed 64 bytes


Example

_gaq.push(['_setCustomVar', 1, 'User Type', 'Member', 2 ]);
_gaq.push(['_trackEvent', 'Shopping', 'Item Removal']);

Click here to read more about GA custom variables

No comments:

Post a Comment