User
Identifying Users to Metrix and Creating a User
To identify a user who is using your application/website to Metrix’s servers—so that Metrix can determine which user is performing the received actions—you must call the following method before invoking any other methods. This method creates a User on Metrix’s servers, which can be accessed through the Metrix user panel in the User Lookup section.
Native
// Call when a user logs into your system
MetrixAnalytics.User.setUserCustomId("userId");
// Call when a user logs out of your system
MetrixAnalytics.User.deleteUserCustomId();Updating User Information
Using the following methods, you can update the information of existing Users in the User Lookup section.
Native
Map<String, Object> attributes = new HashMap<>();
attributes.put("type", "Loyal");
attributes.put("signup_date", "2024-11-20T11:24:03.000Z"); // use ISO 8601 to consider this attribute as s a date
MetrixAnalytics.User.setCustomAttribute(attributes);Using the following functions, you can assign predefined Attributes to the user:
Native
MetrixAnalytics.User.setFirstName("userFirstName");
MetrixAnalytics.User.setLastName("userLastName");
MetrixAnalytics.User.setPhoneNumber("phoneNumber");
MetrixAnalytics.User.setHashedPhoneNumber("hashedPhoneNumber");
MetrixAnalytics.User.setEmail("email");
MetrixAnalytics.User.setHashedEmail("hashedEmail");
MetrixAnalytics.User.setCountry("country");
MetrixAnalytics.User.setCity("city");
MetrixAnalytics.User.setRegion("region");
MetrixAnalytics.User.setLocality("locality");
MetrixAnalytics.User.setGender(gender); // gender value could be "MALE" , "FEMALE" or "OTHER"
MetrixAnalytics.User.setBirthday(birthday); // birthday value type should be 'Long'Note: Each event can have up to 50 attributes, with a maximum length of 512 bytes for each key and value.