Application of Custom Variables - Exercise

Contact Us or call 1-877-932-8228
Application of Custom Variables - Exercise

Application of Custom Variables

Duration: 10 to 15 minutes.

On your news letter signup page you have a drop down menu where visitors can select their professional background (e.g. Engineering, Marketing, etc). You want to segment your visitors based on their profession.

Solution:

In the above example, you will first need to write code that will capture the user input from a drop down menu in regards to their profession background and pass that parameter to _setCustomVar method. Your _setCustomVar method may look like:

 _gaq.push(['_setCustomVar',1,'Profession Type','Engineering',1]); 

In the above example:

  1. Custom Variable is assigned to slot #1.
  2. Custom Variable is labeled as Profession Type.
  3. Value of this Custom Variable is assigned to Engineering.
  4. Since this is a visitor level segmentation, the scope of this custom variable is set to 1.
Next