Tag Labels
Overview
As well as capturing Events, you can also capture labels
.
Labels are very versatile and can be used to capture a wide variety of data. As an example, you can use labels to capture a visitor's gender and date of birth, or event their non-event related activities, such as their choices on a product configuration page.
You must define the label's type
, key
, and value
.
Types
There are 5 label types, and the type must be defined in the label push.
- Int
- Float
- String
- Bool
- Datetime
Commands
To add a new label, you must use the correct command. The label type
commands are as follows:
addIntLabel
Adds an integer label. Can be captured as either string or number.addFloatLabel
Adds a float label. Can be captured as either string or number.addStringLabel
Adds a string label. Must be captured as a string.addBoolLabel
Adds a boolean label. Can be either a boolean or a string - any value other than "false" resolves as true.addDatetimeLabel
Adds a Date/Time label. Must be an ISO 8601 formatted date.
The syntax for capturing labels is as follows:
vscr.push(["Label Type", "Key", "Value"])
For example:
vscr.push(["addIntLabel", "my_intLabel1", "42"])
vscr.push(["addIntLabel", " my_intLabel2", 42])
vscr.push(["addFloatLabel", " my_floatLabel1", 123.45])
vscr.push(["addFloatLabel", " my_floatLabel2", "123.45"])
vscr.push(["addStringLabel", " my_stringLabel", "str value"])
vscr.push(["addDatetimeLabel", " my_dateLabel1", "2015-11-16"])
vscr.push(["addDatetimeLabel", " my_dateLabel2", "2015-11-16T22:23:48+00:00"])
vscr.push(["addBoolLabel", "my_boolLabel", "true"])