setAnonymizationState
The setAnonymizationState() method sets whether a user is anonymous or non-anonymous. When anonymization is enabled, the SDK doesn't collect the user's IP address or user ID. Only country-level location information is available. The SDK also generates a new visitor ID each time the app starts.
The setAnonymizationState(true) is set by default. This means that each user is anonymous by default.
Syntax
(application as PiwikApplication).tracker.setAnonymizationState(isAnonymous)((PiwikApplication) getApplication()).getTracker().setAnonymizationState(isAnonymous);Parameters
isAnonymous (boolean, required)
Whether a user is anonymous or non-anonymous.
trueif the user is anonymousfalseif the user isn’t anonymous
Examples
To mark a visitor as non-anonymous:
(application as PiwikApplication).tracker.setAnonymizationState(false)((PiwikApplication) getApplication()).getTracker().setAnonymizationState(false);Notes
- Data Activation methods use the visitor ID to identify the user's profile. To keep the same profile across app launches, call
setAnonymizationState(false).
Related methods
Updated 2 days ago
Did this page help you?