How to set up user attributes on Hotjar
User attributes in Hotjar allow you to segment recordings and heatmaps based on custom user data. Set them up by implementing the hj('identify') function in your website code with relevant user properties.
Prerequisites
- Active Hotjar account with Business plan or higher
- Hotjar tracking code installed on your website
- Basic JavaScript knowledge
- Access to your website's code or tag manager
Step-by-Step Instructions
Access your Hotjar dashboard
Define your user attributes schema
Common attributes include:
- User ID or email
- Subscription plan
- User role
- Geographic location
Implement the identification code
hj('identify', 'USER_ID', {
subscription_type: 'premium',
user_role: 'admin',
signup_date: '2026-01-15'
});Replace
USER_ID with the actual user identifier and update the attributes with real user data.Set up dynamic attribute tracking
if (user.isPremium) {
hj('identify', user.id, {
plan: 'premium',
features_enabled: user.features.length
});
} else {
hj('identify', user.id, {
plan: 'free',
trial_days_left: user.trialDaysLeft
});
}Test user attribute implementation
hj('identify') function. Open browser developer tools (F12) and check the Console tab for any JavaScript errors. You can also verify the implementation by checking the Network tab for Hotjar API calls.Verify data collection in Hotjar
Create user attribute filters
Common Issues & Troubleshooting
User attributes not appearing in dashboard
Check that you're calling hj('identify') after the Hotjar tracking script loads. Verify your plan includes user attributes feature and wait up to 30 minutes for data processing.
JavaScript errors when implementing hj('identify')
Ensure the Hotjar tracking code is properly installed and loaded before calling identification functions. Wrap your hj('identify') calls in a try-catch block to handle any errors gracefully.
Inconsistent user attribute data
Make sure hj('identify') is called on every page load with consistent user data. Check that your user data source is reliable and attributes are being set with the correct data types.
Filters not working with user attributes
Verify that attribute names in your code exactly match those defined in Hotjar settings. Ensure sufficient data has been collected - filters require multiple sessions with the specified attributes to function properly.