Segment allows website owners to collect data via an API and send it to hundreds of marketing, analytics and sales tools including Google Analytics, Salesforce, MailChimp, Intercom... and Hotjar!
Hotjar can be added as a Destination in Segment. This allows you to install Hotjar, and instantly send customer data over Hotjar's Identify API without you having to add any additional code.
Complete documentation* for setting up Hotjar as a Segment Destination is available on the Segment site.
*In September 2021, Hotjar made a change so that the User Attributes feature is enabled by default if the feature is included in your Hotjar plan. However, the Segment documentation still mentions the need to enable User Attributes; this step can be ignored.
Do I still need to install the Hotjar Tracking Code and Identify API code on my site?
When using Hotjar with Segment, all the necessary code will be injected into your site via the setup process in Segment. Your Tracking Code will be injected into your site through Segment, and User Attributes can be sent via Segment. This allows you to bypass the traditional Hotjar installation and User Attribute code that would normally be added to your site manually.
Using Segment's Identify Spec with the Hotjar Identify API
User Attributes are available on both the Observe Business and Scale plans and the Ask Business and Scale plans.
For our Observe tools (Heatmaps and Recordings), User Attributes are available on the Observe Business or Observe Scale plans. With the Ask tools (Feedback and Surveys), User Attributes are available on the Ask Business or Ask Scale plans. If you're interested in upgrading, check out How to Upgrade Your Hotjar Plan. To upgrade to a Scale plan, reach out to our Sales team through the Hotjar pricing page.
If Hotjar's Identify API is included in your Hotjar plan, data you collect over Segment's Identify Spec can be sent as User Attributes to Hotjar. This means you don't need to write additional code to send this data over Hotjar's Identify API.
User Attributes are facts about your users taken from your site’s data that you can use to more quickly gain insight into the behavior and needs of the users who matter most to your business.
Once implemented, User Attributes allow you to filter Recordings, and target surveys and feedback widgets by these values. They also allow you to lookup and delete user data by user ID making it easy to respect your user's privacy rights - which is especially important when passing personal information to Hotjar.
Hotjar's Identify API cannot store arrays or objects passed to it.
Segment's Identify Spec supports the ability to pass nested objects as data values. Unfortunately, Hotjar's Identify API currently does not and will reject these values.