setCustomVariable
The setCustomVariable() method sets a custom variable.
Syntax
setCustomVariable(index, name[, value[, scope]])Not availableNot availableNot availableNot availableNot availableNot availableParameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| index | number | The index from 1 to 5 where the variable is stored. | Yes |
| name | string | The name of the variable. | Yes |
| value | string | The value of the variable. Limited to 200 characters. | No |
| scope | string | The 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 availableNot availableNot availableNot availableNot availableNot availableNotes
- 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.
Updated 10 months ago
Did this page help you?