userID

The userID property stores a unique identifier for the signed-in user (for example an ID from your CRM or auth system). When isAnonymizationEnabled is false and the value is non-empty, the SDK includes it on standard Analytics tracking. It can also be used together with Audience Manager profile calls in legacy integrations.

Syntax

PiwikTracker.sharedInstance()?.userID = "userId"
[PiwikTracker sharedInstance].userID = @"userId";

Parameters

  • userID string, optional - A unique identifier for the user. Use a non-empty string when the user is known; the SDK does not send a user ID if the property is nil or blank. Prefer setting it right after the tracker starts so early events are attributed correctly.

Examples

PiwikTracker.sharedInstance()?.userID = "ABC123"
[PiwikTracker sharedInstance].userID = @"ABC123";

Notes

  • The user ID is not sent when isAnonymizationEnabled is true.
  • For more on the user ID, see this article.

Related methods