H Hotjar

How to set up user attributes on Hotjar

intermediate 8 min read Updated 2026-03-18
Quick Answer

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

1

Access your Hotjar dashboard

Log into your Hotjar account and navigate to your site dashboard. Click on Settings in the left sidebar, then select User Attributes from the menu. This section shows all currently configured attributes for your site.
User attributes are only available on Business plans and above.
2

Define your user attributes schema

Click Add User Attribute to create new attributes. Enter a Name (e.g., 'subscription_type') and select the Data Type (string, number, or boolean). Add a Description to help team members understand the attribute's purpose.

Common attributes include:
  • User ID or email
  • Subscription plan
  • User role
  • Geographic location
Keep attribute names lowercase with underscores for consistency and easier implementation.
3

Implement the identification code

Add the Hotjar identification script to your website. Place this code after user login or on pages where user data is available:

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.
Call hj('identify') on every page load to ensure consistent user tracking across sessions.
4

Set up dynamic attribute tracking

For dynamic user data, implement conditional logic to capture different user states:

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
  });
}
Use your existing user management system to populate attribute values automatically.
5

Test user attribute implementation

Open your website in a new browser window and perform actions that should trigger the 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.
Test with different user types to ensure all attribute variations are captured correctly.
6

Verify data collection in Hotjar

Return to your Hotjar dashboard and navigate to Recordings. Wait 10-15 minutes for data to process, then click on any recent recording. In the recording details panel, you should see your custom user attributes listed under User Information. Verify that the values match your implementation.
It may take up to 30 minutes for user attributes to appear in your Hotjar dashboard.
7

Create user attribute filters

Go to Recordings or Heatmaps and click Add Filter. Select User Attributes from the dropdown menu. Choose your custom attribute and set the filter criteria (equals, contains, greater than, etc.). Apply the filter to view segmented data based on your user attributes.
Save frequently used filter combinations as custom segments for quick access.

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.

Prices mentioned in this guide are pulled from current plan data and may change. Always verify on the official Hotjar website before purchasing.