The userID() method sets the user ID for a specific user. It can be the same identifier as in your CMS, CRM or sales system. The user ID helps to recognize the user across devices.

Syntax

[PiwikTracker sharedInstance].userID = @"userId";

Parameters

userId (string, required)

A non-empty, unique identifier of the user. Example: ABC123. It needs to be unique for each user. Can be up to 1024 bytes (1024 ASCII characters).

Examples

To set the user ID as ABC123 and send it with a screen view:

[PiwikTracker sharedInstance].userID = @"ABC123";

Notes

  • The user ID won't be sent if isAnonymizationEnabled = YES is set.
  • For more on the user ID, see this article.

Related methods