setCustomVariable

The setCustomVariable() method sets a custom variable.

Syntax

setCustomVariable(index, name[, value[, scope]])
Not available
Not available
Not available
Not available
Not available
Not available

Parameters

ParameterTypeDescriptionRequired
indexnumberThe index from 1 to 5 where the variable is stored.Yes
namestringThe name of the variable.Yes
valuestringThe value of the variable. Limited to 200 characters.No
scopestringThe scope of the variable: "visit" or "page". The default value is "visit".No

Examples

To set a custom variable:

_paq.push(["setCustomVariable", 1, "Blog author", "Jane Doe", "page"]);
Not available
Not available
Not available
Not available
Not available
Not available

Notes

  • Custom variables are set for two scopes: visit and page. The default scope is "visit". Each scope has its own index.
  • Custom variables set for the visit scope are set for the entire session. You don't need to set them on each page.