Skip to main content

Contact Data

Contact will be registered anonymously right after SDK initialization and currently tracked Contact context will be stored on a device. To set specific contact attributes, pass them using UserComSDK.instance.register() function.


Set User Data​

To pass Contact Data, call User.com SDK instance and pass Customer object as an attribute. Customer class is provided by flutter_user_sdk and allows to update Standard and Custom attributes.

info

All attributes should have simple values. Read more about Contact Attributes in User.com Docs.

You can add any number of Custom attributes, or use Standard attributes and combine them. Sending data using this method will update currently tracked Contact with all the attributes specified or switch tracking when Contact already exists in User.com.

UserComSDK.instance.registerUser(
customer: Customer(
userId: 'my_own_id_3',
email: 'my_own_user@gmail.com',
gender: 2,
firstName: 'Test',
lastName: 'User',
phoneNumber: '+1234567890',
score: 100,
unsubscribed: true,
)
..addCustomAttribute('country', 'USA')
..addCustomAttribute('has_benefits', true)
..addCustomAttribute('nick', 'freddy')
..addCustomAttribute('age', 22),
);

Authentication​

Table below explains Contact Authentication rules when sending values for specific Attributes.

AttributeUser.com nameDescription
userIdUser IDWhen there is no Contact with this User ID, tracking will continue on the current Contact. When there is a Contact with this User ID, tracking will switch to the already existing Contact
emailEmailEmail value is not used to authenticate Contact. It will always update currently tracked Contact
other attributes-Not used for authentication

Use your own userID to make sure Contacts are identified consistently on all devices.


Logout​

To logout and clear all contact-related resources within SDK only and prevent from receiving push messages, invoke:

UserCom.instance.logout();

Calling this method will create a new Anonymous Contact and attach FCM Token.

info

If you call register() method after logout, you can still send Events to same contact. Just pass userId of a Contact you want to track.