User Attributes & Preferences
Managing User Data
The NetmeraUser
class allows you to send structured information about your application's users to Netmera. The ideal time to update user attributes is right after the user logs into your application.
User ID Management
For optimal performance and data integrity:
Update user information at login: It’s crucial to update the user information as soon as the user logs in.
Unique userId: Ensure that each user has a unique
userId
. Assigning the sameuserId
to multiple users leads to data inconsistencies and is not recommended.
Updating User Information
After obtaining user information, set or update the user data by using the following example:
The userId
cannot be removed, even if you assign nil
to it.
Creating Custom Profile Attributes
Step 1: Navigate to the Developers section
Custom profile attributes must be created and configured in the Netmera Panel before they can be used in the application.
Go to Panel > Developers > Profile Attributes > Create New Attribute.
Step 2: Fill in Attribute Details
Define the following information:
Name: The unique identifier for the attribute.
Label: A user-friendly name for the attribute.
Description: A brief description of the attribute.
Data Type: Choose the appropriate data type for the attribute.
Is Array: Define whether the attribute can hold multiple values.
Step 3: Save the Attribute
After clicking Save, the custom attribute will be available for assignment to your users.
Step 4: Generated Code for Custom Attributes
Once the attribute is defined in the Netmera Panel, the generated code can be found at the bottom of the Profile Attribute page, under the Generate Code section. This code must be added to your Netmera Panel under Profile Attributes > User Class.
Email Subscription Preferences
The Netmera SDK provides methods to manage email subscription preferences for your users.
1. Check Email Subscription Status
Use the following method to check if the user has allowed email subscriptions:
Returns: A
Boolean
value (true
if the user has allowed email subscriptions, otherwisefalse
).
2. Update Email Subscription Preferences
Set the user's preference for email subscriptions using one of the methods below:
Allow Email Subscriptions
Disallow Email Subscriptions
These methods enable you to respect user preferences for email communications within your application.
Last updated
Was this helpful?