Register a user
To register a user you can either send information about the user, or create a new anonymous user without providing any data. Usually you send information about a user when he's logging into the app or registering - that's when the user passes some data in forms - but before that you might want to create a new user just to gather information about user's events and screen views.Registering anonymous user
To register anonymous user use ping() method - it will create a user if no attributes were set before.
Set standard and custom attributes
You can add any number of custom customer attributes, or use predefined standard attributes
UserSDK.default?.setUserData([ UserSDK.UserDataKey.firstName : "Test", UserSDK.UserDataKey.lastName : "User", UserSDK.UserDataKey.email : "firstname.lastname@example.org", UserSDK.UserDataKey.phone : "+1222333444", UserSDK.UserDataKey.userId : "yourcustomerid" ]) UserSDK.default?.setCustomUserData([ "custom attribute name" : "custom attribute value" ])
To logout and clear all user-related resources within SDK, invoke: