Advice and answers from the UserGuiding Team
Users
Engagement
Settings
Setting a Default Value to a User Attribute
Learn how to set a default value.

Overview

When working with UserGuiding, an essential aspect of personalizing user interactions and content involves sending user attributes to the platform. This process allows you to enhance the relevancy and effectiveness of your Guides, Hotspots, and Modals by tailoring them to the specific characteristics and behaviors of your users.

 

One helpful feature in this context is the ability to set default values for these attributes, which helps ensure consistency and reliability in the data you provide.

 

In the example provided, the `userGuiding.identify()` method is used to send user attributes to UserGuiding. This method is crucial for updating and maintaining accurate user profiles, which in turn allows UserGuiding to deliver more personalized content and experiences. Here's how default values can be effectively applied within this method:

 

userGuiding.identify(user.id, { 
    company: “Company A, 
    name: user.name, 
    department: user.department 
});

 

Setting Default Values

The `company` attribute in this example is assigned a static default value of “Company A”. This means that every time the `identify()` method is invoked, the `company` attribute will automatically be set to “Company A” unless a different value is specified.

 

Using a static value for specific attributes ensures that there is a consistent baseline value applied across all users. This is particularly useful for attributes that are uniform across a segment of users or for default settings that should be applied universally.

 

Setting Dynamic Attributes

In contrast, the `name` and `department` attributes are assigned dynamic values derived from the user object (`user.name` and `user.department`).

 

These values are specific to each user and are pulled from the user's data at runtime. By using dynamic attributes, you ensure that the data sent to UserGuiding reflects the unique information of each individual user, allowing for a more personalized and accurate representation of their profile.

 

 

By combining default and dynamic values, you can ensure that your user profiles are both accurate and tailored, leading to a more engaging and relevant user experience. This approach not only maintains the integrity of user data but also enhances the effectiveness of UserGuiding's features.

 

Moreover, this practice is beneficial for maintaining consistency in scenarios where specific user attributes do not change often or where a default value is necessary for specific functionality. For instance, a default `company` value might be used for segmentation or filtering purposes, while dynamic attributes such as `name` and `department` enable personalized content delivery based on the individual user’s details.

Did this answer your question?