To create a custom variable you will need to use the _setCustomVar() method. You can pass four different arguments through the _setCustomVar method.
|Index or Slot||This is a required field. You have total of 5 slots to play with for a single visit. This field will only except an integer argument, i.e. numbers from 1 to 5.|
|Name||This is a required field which helps in identifying the custom variable within the report section. Name can be any series of letters, numbers or symbols (e.g. Professions).|
|Value||This is a required field and it is always paired with the argument Name. One custom variable can have many values (e.g. a custom variable named Profession can have two values; engineering and marketing).|
|Scope||There are three types of scopes, each represented by a numerical value. 1 - Visitor, 2 - visit or session and 3 - page-level. This is an optional field and by default it is set to page-level interaction.|
Syntax for creating a custom variable is as follows: