setVisitorId
The setVisitorId() method sets a custom visitor ID.
By default, the visitor ID is created automatically when the tracker instance is created and is saved between app launches. The visitor ID helps to recognize sessions that belong to the same user.
Syntax
await FlutterPiwikPro.sharedInstance.setVisitorId('visitorID');Parameters
visitorID (string, required)
The visitor ID set for a specific user.
Format: 16-character hexadecimal string.
Example: 0123456789abcdef
Examples
To set a visitor ID to 0123456789abcdef:
await FlutterPiwikPro.sharedInstance.setVisitorId('0123456789abcdef');Notes
- When setAnonymizationState(true) is enabled, a new visitor ID is created each time the app launches.
- Each user should have a unique visitor ID. The visitor ID shouldn’t change between app launches.
- We recommend using the user ID instead of the visitor ID.
Updated 21 days ago