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

index (number, required)

The index from 1 to 5 where the variable is stored.

name (string, required)

The name of the variable.

value (string, optional)

The value of the variable. Limited to 200 characters.

scope (string, optional)

The scope of the variable: "visit" or "page". The default value is "visit".

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.