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.

    [[UserSDK default] ping];
    Set standard and custom attributes

    You can add any number of custom customer attributes, or use predefined standard attributes

       UserSDK.UserDataKey.firstName : "Test",
       UserSDK.UserDataKey.lastName : "User", : "", : "+1222333444",
       UserSDK.UserDataKey.userId : "yourcustomerid"
       "custom attribute name" : "custom attribute value"
    NSDictionary *userData = @{
        @"first_name": @"Test";
        @"last_name": @"User";
        @"email": @"";
        @"phone": @"+1222333444";
        @"user_id" @"yourcustomerid";
    [[UserSDK default] setUserData:userData];
    [[UserSDK default] setCustomUserData:@{@"custom attribute name": @"custom attribute value"}]
  • Logout

    To logout and clear all user-related resources within SDK, invoke:

    [[UserSDK default] logout]