To track an attribute for a visitor, use the following code in the Persosa Javascript library:

persosa('attribute', '<Operation>', '<Attribute>' [, '<Value>']);

Operation

The operation to perform on the given attribute. One of the following:

set
Set the attribute to the given value.

delete
Delete the current value of the attribute.

push
Push the given value onto an array. If <Attribute>  is not an array, it is set to an array and the value pushed onto it.

pushunique
Same as push, but only pushes the value if it doesn't already exist in the array (case sensitive).

deletefromlist
If the given value exists in the array, remove it (case sensitive).

Attribute

The name of the attribute to perform the operation on.

Value

If applicable, the value to use when performing the operation.

Example

Let's track the age of a visitor as we collect it from the form.

// Set the age value
persosa('attribute', 'set', 'age', ageVal);

// Clear the age value
persosa('attribute', 'delete', 'age');

Did this answer your question?