User Attributes
User attributes are key-value pairs that represent the characteristics, behaviors, or preferences of visitors interacting with your website or application. These attributes can be used to create distinct audience segments for targeted content delivery and personalized user experiences.
Set and Update User Attributes
https://personalize-edge.contentstack.com/user-attributesSet and Update User Attributes
The Set and Update User Attributes request lets you create and update custom attributes in a project.
Attributes created / updated with this API call needs to have a corresponding custom attribute created in the Attributes module with the same key.
The above request:
- Creates new attributes for the user if they do not already exist.
- Updates existing attributes with the provided values. In case of an attribute conflict (existing attribute has a value), and the new value takes precedence during the update.
- Only the specified key:value pairs for the attributes will be updated, and the non-specified values remain unchanged.
{
"age": "10"
}User Attributes added successfully
Merge User Attributes
https://personalize-edge.contentstack.com/user-attributes/actions/mergeMerge User Attributes
The Merge User Attributes request lets you merge attributes using the source (anonymous user) and target (custom user) UIDs in a project.
You would want to use this API request, when an anonymous user logs in and converts into a known user of your digital property, and merge the attribute details of the anonymous user (source) into the known user (target).
Note: In case of conflict in attributes set against the source UID and target UID, the attribute value for the source UID is given precedence.
{
"sourceUserUid": "x-user-id",
"targetUserUid": "y-user-id"
}User Attributes merged successfully