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 easily 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 for all Business and Scale plan customers. 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
If you're on a Hotjar Business 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 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.
We appreciate this might be a frustrating limitation. To see which API improvements we are working on next, check out our Product Roadmap. Every quarter, our Product team reviews, adds and prioritizes what to build next.