This article overviews how you can use an existing Google Tag Manager (GTM) installation on your site to install Hotjar, take advantage of Events, and send User Attributes to gain even more insights.
You'll need to have installed GTM on your live website to use this article. See Google's Tag Manager overview guide to learn how to install GTM on your site if you decide you want to use GTM with Hotjar.
- How to install Hotjar's Tracking Code on your site with GTM
- How to send Events to Hotjar with GTM
- How to send User Attributes to Hotjar with GTM
How to install Hotjar's Tracking Code on your site with GTM
You must install Hotjar's Tracking Code on your live website before you can start using Hotjar's tools and features. After setting up GTM on your site, a GTM container will be present. Hotjar detects this GTM container, and you can install the Hotjar Tracking Code by selecting the recommended Hotjar + GTM installation integration option during the installation process. To help you install the Hotjar Tracking Code using the integration, see our Hotjar + GTM installation integration guide.
Suppose you have issues using the Hotjar + GTM installation integration. In that case, you can also install the Hotjar Tracking Code with GTM using the Hotjar Tracking Code tag or as a Custom HTML tag.
How to send Events to Hotjar with GTM
Hotjar Events provide a way to filter your collected data or trigger Hotjar tools based on actions or changes that happen on your site. See our article What are Events to get an overview of what events are and how they work.
With GTM installed on your site, it's possible to send actions or changes on your site as events to Hotjar using GTM. Events can be set up within GTM itself, saving you from needing to add further custom code directly to your live website. To get started with sending events to Hotjar using GTM, see our How to Send Events with Google Tag Manager article.
How to send User Attributes to Hotjar with GTM
User Attributes enable you to send existing data about your users to Hotjar for use in Hotjar's tools. You can filter collected Recording and Heatmap data by User Attributes, create Segments or show Surveys and Feedback widgets only to specific users. See our What Are User Attributes article for more details on User Attributes.
One way of sending your user data to Hotjar as User Attributes is with an existing GTM installation if it is already present on your site. Follow our guide on How to Send User Attributes with Google Tag Manager to learn how you can set this up and enhance your filtering and targeting options inside Hotjar.