getCustomVariable

The getCustomVariable() method returns the value of the set custom variable.

Syntax

getCustomVariable(index[, 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.

scope (string, optional)

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

Returns

If the custom variable exists, the method returns the variable name and value. Otherwise, it returns false.

Format: "variable name", "variable value". (Example: "Blog author", "Jane Doe")

Type: string[] | boolean

Example

To get the variable value:

_paq.push([  
  function () {  
    console.log(this.getCustomVariable(1, "page"));  
  },  
]);
Not available
Not available
Not available
Not available
Not available
Not available

A sample of the return value:

"Blog author", "Jane Doe"