trackCustomVariable
Deprecated
This method is no longer recommended. Audience Manager is no longer available in the latest product version.
The trackCustomVariable() method sets a custom variable in the screen scope. The value can be sent to Piwik PRO with a screen view or other event.
Syntax
await FlutterPiwikPro.sharedInstance.trackCustomVariable(
index: index,
name: 'name',
value: 'value',
scope: CustomVariableScope.visit);
Parameters
index (number, required)
The index where the variable is stored.
Note: If setIncludeDefaultCustomVariable(true) is set, you can only use an index greater than 2 because this method automatically tracks some items under the index 1-2. The setIncludeDefaultCustomVars(true) method is set by default.
name (string, required)
The name of the variable. Valid format: UTF-8.
value (string, optional)
The value of the variable. Valid format: UTF-8. Limited to 200 characters.
Examples
To set a custom variable in the screen scope and send it with a screen view:
await FlutterPiwikPro.sharedInstance.trackCustomVariable(
index: 1,
name: 'rating',
value: '5',
scope: CustomVariableScope.visit);
Notes
- The screen scope refers to events like a screen view or file download and holds a captured variable for each event. The value is removed after an event is called.
Related methods
Updated 2 days ago